Click to See Complete Forum and Search --> : Get last preg_match


lehula
09-03-2007, 10:58 AM
Is there any sort of modifier (/?) that I could put after my regex so that it will get the last preg_match instead of the first? If not, anyone got any ideas on the quickest way to do it with another method? Thanks

bokeh
09-03-2007, 12:58 PM
$LastOne = null;
if(preg_match_all($regex, $subject, $matches))
{
$LastOne = $matches[0][count($matches[0])-1];
}

lehula
09-03-2007, 03:33 PM
exactly what I was looking for. thanks!!!!!