sanfly Posted January 20, 2007 Share Posted January 20, 2007 HiIve 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 More sharing options...
effigy Posted January 20, 2007 Share Posted January 20, 2007 [tt]|<(?!br)(.+?)>|s[/tt] Link to comment https://forums.phpfreaks.com/topic/35003-removing-any-tag-except/#findComment-165098 Share on other sites More sharing options...
sanfly Posted January 20, 2007 Author Share Posted January 20, 2007 Works great, Thanks ;D Link to comment https://forums.phpfreaks.com/topic/35003-removing-any-tag-except/#findComment-165101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.