I want to grab the URL with highest pg
value:
$html ='
<a href="http://example.com/?pg=1"></a>
<a href="http://example.com/?pg=2"></a>
<a href="http://example.com/?pg=3"></a>
';
I use this regex to locate the appropriate links:
preg_match_all('/<a.*href="\.\/\?pg=(\d+)".*>(?:.*)<\/a>/U', $html, $preg_matches);
Sometimes, the links include another parameter:
http://example.com/?pg=3&test=1
My question is, how do I adjust my regex so links with the added parameters are included as well?