MDL-52475 core: workaround PHP7 bug #70110 with preg_match