protected function normalizeRegexPattern($pattern)
    {
        if (false !== @preg_match($pattern, null)) {
            return $pattern;
        }

        $boundedPattern = '~\b' . str_replace('~', '\~', $pattern) . '\b~';

        if (false !== @preg_match($boundedPattern, null)) {
            return $boundedPattern;
        }

        return '~\b' . preg_quote($pattern, '~') . '\b~';
    }
protected function normalizeRegexPattern($pattern)
    {
        if (false !== @preg_match($pattern, null)) {
            return $pattern;
        }

        $boundedPattern = '~\b' . str_replace('~', '\~', $pattern) . '\b~';

        if (false !== @preg_match($boundedPattern, null)) {
            return $boundedPattern;
        }

        return '~\b' . preg_quote($pattern, '~') . '\b~';
    }
protected function normalizeRegexPattern ( $ pattern ) { if ( false !== @ preg_match ( $ pattern , null ) ) { return $ pattern ; } $ boundedPattern = '~\b' . str_replace ( '~' , '\~' , $ pattern ) . '\b~' ; if ( false !== @ preg_match ( $ boundedPattern , null ) ) { return $ boundedPattern ; } return '~\b' . preg_quote ( $ pattern , '~' ) . '\b~' ; }
Normalize the supplied regular expression pattern.

@param string $pattern
@return string
Normalize the supplied regular expression pattern .