Take a look at this html:
<div class="foo"><a href="link1">link1</a><a href="link2">link2</a></div>
<div class="bar"><a href="barlink">barlink</a></div>
I would like to know if I can loop in all links inside foo with a regular expression within php. I tried this but isn't working:
preg_match_all(
'#<div.*?class="foo".*?<a.*?>(?P<text>.*?)</a>#xi',
$text,
$matches,
PREG_SET_ORDER
);
sadly, in this case, it must be regex, not xml or other parsers.