TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT] Regexp and HTML sanitization



Hello all --

I'm developing a web application with PHP and MySQL for data entry. I need
to "sanitize" the HTML that my users enter (i.e. remove all HTML tags
except for BR, P, IMG, etc.). I've been trying to use a regular expression
to do this, but it's not working yet. Anyone have any suggestions? If I
can't do it in a single regular expression, it makes the code rather
complex.

Pacem in Terris / Mir / Shanti / Salaam / Heiwa
Kevin R. Bullock