How to use php preg_replace and regular expression to remove all the hyperlink which contain <a href="#. Here is what I write, but it doesn't work
$newlink = preg_replace('/^<a href="#(.*)" (?:.*?)>(.*)<\/a>/is', '', $link);
I want replace these links which as aa anchor mark
<a href="#part1">go to part1</a>
<a href="#part2">go to part2</a>
<a href="#part3">go to part3</a>
to empty value.
"as required by your regex. But please be very careful if you handle HTML with regular expressions. In almost any case it is not what you want to do but use a proper parser instead.