protected function assertNoEval($pattern) { if (preg_match('/(.).*\\1(.+)$/', trim($pattern), $match) && strpos($match[1], 'e') !== false) { throw new \Exception("Using the eval modifier for regular expressions is not allowed"); } }