Jump to content


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


strip HTML tags but leave <em> and <i>

Recommended Posts

Hi all,

I need to strip all HTML tags from user input, save and .

I'm trying regular expressions, but am having big trouble getting those to work.

I thought of something like this (if found a tag with something else then 'i' remove tag): preg_replace(?(?=<[^i]+>)"");
But that doesn't work.

How would I go about that?

Thanks a lot!


Share this post

Link to post
Share on other sites


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.