I have the following string:
$linkString="The Following is a link to google <a class='links' href='http://google.com'>
http://google.com
</a>
";
In this string the hypertext of the html link in new line. I want to remove and may be replace all of the link (its html tag and the hypertext) from the string, so I tried the following:
<?php
$linkString="The Following is a link to google <a class='links' href='http://google.com'>
http://google.com
</a>
";
//Remove link tag:
echo preg_replace('/<[^>]*>/','',$linkString);
However, the above example prints out:
The Following is a link to google
http://google.com
This is an online DEMO: http://codepad.org/whw81bwa
I want to know a regex that able to remove all the link (tag and hypertext)