Say I have the following text
..(content)............. <A HREF="http://foo.com/content" >blah blah blah </A> ...(continue content)...
I want to delete the link and I want to delete the tag (while keeping the text in between). How do I do this with a regular expression (since the URLs will all be different)
Much thanks
This will remove all tags:
preg_replace("/<.*?>/", "", $string);
This will remove just the <a> tags:
<a>
preg_replace("/<\/?a(\s+.*?>|>)/", "", $string);
2.1m questions
2.1m answers
60 comments
57.0k users