Jump to content

Regex HTML


graham23s

Recommended Posts

Hi Guys,

 

Using this code:

 

$regex_pattern = "/<a href=\"(.*)\">(.*)<\/a>/";
preg_match_all($regex_pattern,$result,$matches);
$i = 0;
foreach($matches as $match)
{
print $match[0];
}

 

I gather all the "a href" anchor tags on page, but my foreach only outputs the first one and doesn't loop them all? plus the first say 5 anchor tags i don't really need is there a way to  start looping from say the 5th one onwards?

 

thanks guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/191135-regex-html/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.