extracting urls from a page with regex
I have this bit of php that extracts all urls from a page:
$regex = '/https?\:\/\/[^\" ]+/i';
preg_match_all($regex, $page, $matches);
$links = ($matches[0]);
foreach($links as $link)
{
echo $link.'<br />';
}
How would I modify it to extract not all links but just the ones that
match a certain partial url, in this case: `http://www.site.com/artist/'
where the result I am looking for is a list like:
http://www.site.com/artist/Nirvana/
http://www.site.com/artist/Jayz/
And so on.
No comments:
Post a Comment