I'm trying to grab all url's in a big css file.
I tried using this regex:
preg_match_all("/url\('(\\'|[^'])*'\)/m", $css, $matches);
$css
is a 10kB variable, read from a css file using file_get_contents
.
$matches
is an empty array.
However, this results in a (net::ERR_EMPTY_RESPONSE)
error in chrome: the server doesn't send any data. If i return the function just before this line, everything works fine. If i return the function just below this line, I get an empty response.
It doesn't even send the data I outputted before that line, and it responds (with an empty response) within a few seconds - nowhere near the 30s timeout.
It worked just fine when I first used this regex, and passed the output to the above code.
preg_match_all("/@font-face{[^}]+}/m", $css, $matches);
That row was before I realized I needed the other URL's - not only the fonts.
Does anyone have any idea what went wrong?
UPDATE:
Could it be this bug?
https://bugs.php.net/bug.php?id=62049
links to:
http://codepad.org/FmlJi8N9
and a quick google search later:
Warning: preg_match(): Internal pcre_fullinfo()
How can I fix this?