Jump to content

Remove all hyperlinks from HTML


texelate

Recommended Posts

Can someone help me with the regular expressions to remove all the hyperlinks from some HTML but leave the text for thelink in there?

Eg:

$html = '<div>This is <a href="link.html">Link 1</a> and <a href="link.html" target="_blank">Link 2</a> etc</div>';

. . . would become . . .

'<div>This is Link 1 and Link 2etc</div>'

Thanks.
Link to comment
https://forums.phpfreaks.com/topic/27952-remove-all-hyperlinks-from-html/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.