Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正则表达式问题php预匹配_Php_Regex - Fatal编程技术网

正则表达式问题php预匹配

正则表达式问题php预匹配,php,regex,Php,Regex,正在尝试匹配以下内容: rawurl=”http://www.domain.com/page/etc/" URL本身是可变的,可以包含所有种类?查询字符串和更多。 是否有一个转义函数来保证正则表达式的安全 到目前为止我有这个 $var is already defined.. $url = "www.adomain.com/with/extras/" $url = str_replace(" \/ ","/",$url);

正在尝试匹配以下内容:

rawurl=”http://www.domain.com/page/etc/"

URL本身是可变的,可以包含所有种类?查询字符串和更多。 是否有一个转义函数来保证正则表达式的安全

到目前为止我有这个

            $var is already defined..
            $url = "www.adomain.com/with/extras/"
            $url = str_replace(" \/ ","/",$url);  // maybe more needed here. 
            $pattern = "/rawurl\=\"http\:\/\/$url/";                
            preg_match($pattern, $var, $out);

由于对正则表达式的格式设置有问题,几个小时以来,我一直在异想天开。感谢您的帮助……

看看我是怎么错过了这个功能这么长时间的?