Using preg_match_all(), I want to match something like:
...randomtext...>MATCH1</a>" (MATCH2)"...randomtext... EDIT: to clarify, this is exactly the string I’m trying to extract data from, including the brackets, quotes, angle-brackets etc.
Here’s what I’ve tried: preg_match_all("/^>(.+?)</a>\" \((.+?)\)\"$/", $htmlfile, $matches);
It should extract MATCH1 as $matches[1][0] and MATCH2 as $matches[2][0]
Any idea why it isn’t working?
Thanks
You didn’t escape your end tag
</a>This should work:
See Codepad example.