Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Looking for the same link but with nofollow rel

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