Page 1 of 1

HTML stripping

Posted: Tue Apr 10, 2007 5:47 pm
by igoy
feyd | This thread has been split from a much older, far more dead thread: viewtopic.php?t=34588

No matter how much I try.. I can't get regex in my head.

I'm trying to find a similar PHP function, but I want to keep only <b>,<i>,<strong>,<em>,<ol>,<ul>,<li> tags... all others tags and properties (even style and nasty &nbsp;s) to be erased from user posted content, and then store it in database. Can anyone help ??

Posted: Tue Apr 10, 2007 7:16 pm
by feyd
strip_tags() maybe?

or a piece of code I whipped up a while ago: http://code.tatzu.net/cleantags/