public static function formatRegex($pattern)
    {
        if (strpos($pattern, '/') !== false
            && strpos($pattern, '\\/') === false
        ) {
            $pattern = str_replace('/', '\\/', $pattern);
        }
        return '/' . $pattern . '/';
    }
public static function formatRegex($pattern)
    {
        if (strpos($pattern, '/') !== false
            && strpos($pattern, '\\/') === false
        ) {
            $pattern = str_replace('/', '\\/', $pattern);
        }
        return '/' . $pattern . '/';
    }
public static function formatRegex ( $ pattern ) { if ( strpos ( $ pattern , '/' ) !== false && strpos ( $ pattern , '\\/' ) === false ) { $ pattern = str_replace ( '/' , '\\/' , $ pattern ) ; } return '/' . $ pattern . '/' ; }
Formats a goal regex pattern to a usable regex

@param string $pattern
@return string
Formats a goal regex pattern to a usable regex