Swear word substitution

From: Date: Thu, 14 Nov 2002 15:39:26 +0000
Subject: Swear word substitution
Groups: php.general 
Request: Send a blank email to php-general+get-124444@lists.php.net to get a copy of this message
I've got a mysql based website with a php scripted fromt end. I want to parse the output the php scripts get from the database before "printing it as html" for swear words and substitute these for more acceptable words (on a word for word basis). I need to do it this way as I want to keep the original posts in their "rude" form in case I need evidence for misuse of the site. I need to be able to check for words separated by non alpha characters in case people get clever and write obscenities separated w i t h s p a c e s or with o_t_h_e_r characters or even new l i n e s or wordsruntogetherintoonelongword. I also want a list of permitted words that contain swearwords such as "Scunthorpe" which won't get changed. Has anybody done this? I have a feeling that there is a 1 line regular expression out there that will do this nicely. Any help appreciated Feeling rusty at coding... CJ

« previous php.general (#124444) next »