I have blog data like:
This is foreign <a href="xyz.com">link</a>, this is my site's <a href="mysite.com">link</a> and so on.
What I want is to do is filter the links of foreign sites, i.e “<a href="xyz.com">link</a>“. So that my final output is:
This is foreign link, this is my site's <a href="mysite.com">link</a> and so on.
I tried “preg_replace” but no pattern helped.
This shouldn’t be done with regular expressions.
Try something like a DOM parser.
I don’t know if you’re using PHP, but this one very easy to use:
http://simplehtmldom.sourceforge.net/
Hope this helps.