开发者

Warning: preg_match() [function.preg-match]: Unknown modifier '/' [duplicate]

This question already has answers here: Warning: preg_replace(): Unknown modifier (3 answers) Closed 3 years ago.

I'm trying to use preg_match to return all the URL's that are inclosed in " " in a page source code.

The code I am using is

pr开发者_如何学编程eg_match('"http://(.+?)\"', $code, $matches);

And I am getting the following error:

Warning: preg_match() [function.preg-match]: Unknown modifier '/' in .... on line 13


preg_match('~"http://(.*)"~iU', $code, $matches);

Your issue was you need delimiters (I chose ~) to use with the pattern. See the preg_match() man page for more information.


Try this:

preg_match('"http:\/\/(.+?)\"', $code, $matches);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜