Jump to content

Removing any tag except <br />


sanfly

Recommended Posts

Hi

Ive only used a tiny bit of regex in the past, but I feel like this should be easy but Ive tried a million different things and just cant get it.

ive used regex successfully to remove all tags in a string using the following

[code=php:0]$pattern = "|\<(.*?)>|s";
$c_desc2 = preg_replace($pattern, "", $c_desc2)[/code]

However, I want to be able to leave the line break tags <br /> in, and cant figure out how to make the exception.  Can anyone help?

Cheers
Link to comment
https://forums.phpfreaks.com/topic/35003-removing-any-tag-except/
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.