开发者

regex question php preg_match

trying to match the following:

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

the URL itself is variable and could contain all sorts! ? querystrings and more. Is there an escape function to make it regex safe?

so I have this so far

            $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);

having problems formatting t开发者_如何学Che regex correctly, have been going cross eyed now for several hours. Any help appreciated...


Take a look at preg_quote

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜