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.
Thanks two of all, But both of your answer still not work for me.
I am not good at
regular expression, I read many documents and write again. maybe this looks ugly, but it work 🙂