I'm working on a small project using regex. and i found some difficulties
i want to check if the $content contain the same href
value with nofollow
rel
.
this is my PHP code :
$link = 'http://www.yahoo.com';
$content = '<a href="http://www.yahoo.com">yahoo page1</a><a href="http://www.google.com">google page1</a>';
preg_match_all('/<[\s]*a[\s]*(href)="?' . $link . 'rel="nofollow"?[\s]*[\/]?[\s]*>/si', $content, $matches);
print_r($matches);
How can i return true if $link
exist in $content
with nofollow
rel
Comments
Post a Comment