I am trying to match a html element but I don’t think its matching since $titles is empty – can anyone correct me?
My preg_match:
preg_match_all("~<td align=\"left\" width=\"50%\">[^<]*. <b><a href=\"(.*?)\">[^<]*</a>~i", $main, $titles);
Example HTML to match:
//<td align="left" width="50%">1. <b><a title="Wat" href="http://www.exmple.com/q.html">Wat</a></b><br></td>
Am I missing something?
Thanks all for any help
There’s nothing to match
title="Wat"in the<a>tag.I’d suggest not using a regex to parse it though. I’m not too familiar with PHP but I’m sure it already has something that will do most of the work for you.