警告:preg_match()[function.preg-match]:未知修饰符'/' [英] Warning: preg_match() [function.preg-match]: Unknown modifier '/'
本文介绍了警告:preg_match()[function.preg-match]:未知修饰符'/'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用preg_match返回页面源代码中所有包含在"中的URL.
I'm trying to use preg_match to return all the URL's that are inclosed in " " in a page source code.
我正在使用的代码是
preg_match('"http://(.+?)\"', $code, $matches);
我收到以下错误:
Warning: preg_match() [function.preg-match]: Unknown modifier '/' in .... on line 13
推荐答案
preg_match('~"http://(.*)"~iU', $code, $matches);
您的问题是,您需要使用定界符(我选择〜)才能与模式一起使用.有关更多信息,请参见 preg_match()手册页.
Your issue was you need delimiters (I chose ~) to use with the pattern. See the preg_match() man page for more information.
这篇关于警告:preg_match()[function.preg-match]:未知修饰符'/'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文