HTML stripping

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

HTML stripping

Post 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 ??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

strip_tags() maybe?

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