$pattern = '#^' .strtr(preg_quote($pattern, '#'), $transforms) .'$#' .$modifiers; return (boolean)preg_match($pattern, $string); } }