Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

preg-match

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

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

And I am getting the following error:

Warning: preg_match() [function.preg-match]: Unknown modifier '/' in .... on line 13
like image 616
ron8 Avatar asked Jul 25 '10 03:07

ron8


1 Answers

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.

like image 183
Jim Avatar answered Oct 17 '22 05:10

Jim