On 6/28/07, Richard Davey <rich@xxxxxxxxxxxxx> wrote:
Hi all, Just wanting to pick your collective brains on this one: How do you go about implementing a swear / bad-word filter in PHP? Reasons for needing one aside, I'm just wondering if you favour a regexp, a substr_count, or what? Do you like to *** out the bad words, or just error back to the user? (I guess that is application specific). There are always ways to circumvent them, but I'm still curious to know how you prefer to handle it. Cheers, Rich
This is a really though thing to implement, let's say you don't want to the word "ass" in your message coming from the user, and the message contains this: Hi, in the archive I attached is a picture of my ass, the password is abcdef. The word ass is not wanted, so you *** it, but if you do that with a regexp or such, then password would become p***word, or you want to check only for real words (so spaces on both sides), but then somebody would write !ass! or something like that. Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php