Jacob
Jacob

Reputation: 2767

PHP REGEX Exclude Certain Tags?

For REGEX, I am wondering how I would clear all HTML tags entered except for the simple ones, such as <a>, <b>, <i>, <pre>. I know that I can use this regex to exclude all html charicters, but I am not sure how I would go about only removing some, and deleting the others while conserving the content inside. Thanks!

Upvotes: 0

Views: 502

Answers (1)

conrad10781
conrad10781

Reputation: 2273

See the second parameter in :

http://php.net/strip_tags

Essentially, you can call this function and list the tags you don't' want to be stripped.

Upvotes: 6

Related Questions