Give this a whirl:
Code:
<?php
$result = '<a href="http://www.dynamicdrive.com/forums/?this=3">whatever</a>';
preg_match ('/(<a href=\")(.*?)(\?|\/\"|\")/i', $result, $matches);
$match=$matches[2];
if (substr($match,-1,1)=='/') $match=substr_replace($match,'',-1,1);
$match=explode("/","$match");
$found=end($match);
print $found;
?>
I can't help but think that there must be an easier way to do this without regex, but I am not understanding exactly what your script is supposed to do. I am sure that the pcre could be tightened up a bit, but it works.
Try a few different things and let us know what fails.
Bookmarks