@NevermoreMay 31.2003 — #What language are you using? In PHP I would use str_replace() to replace 'bad words' even if they were inside another word. I wouldn't use regular expresiions because they could match other, 'none-bad' words.
This can be done in JavaScript, but since you can't run a forum with JavaScript, I wouldn't bother. If you do want JavaScript code to do it, this should do the trick:
reg=/[b|B][a|A][d|D]/;
newstr=strings.replace(reg,"b*d");
reg is a regular expression that matches the word 'bad' whatever the case of each letter. The next line is matching the regular expression to the string and filtering out the word 'bad' by asterisking the a. To change this script, just change the letters in the first line, by putting the different case each letter can be in square brackets seperated by a |. e.g.
[g|G][o|O][o|B][e|E][r|R] would match goober, Goober, GoObEr etc. Then change the word you want to replace it with in the second line.
If you need any more help customizing it, just ask.
@NevermoreMay 31.2003 — #The problem with accessing a database for the words is that if it takes a long time (for a long message), you can impair the performance of your database. For that reason, I find it easier to hard-code the filtering into the code. Of course, if the route taken is JavaScript, the problem is academic.
@jeffmottMay 31.2003 — #[b]reg=/[b|B][a|A][d|D]/;[/b][/quote]This will actually match ||| or Ba| or b|D, and such. There is also an i flag to indicate case insensative so you do not have to provide alternates for every character. e.g.,[size=2]/bad/i[/size]
@CharlesMay 31.2003 — #[font=georgia]I don't know anything about PHP, but I cannot believe that it doesn't support regular expression flags. In perl [font=monospace]s/bad/***/gi[/font] would substitute "***" for your bad work globally and ignoring case. [font=monospace]s/bW*aW*dW*/***/gi[/font] would do the same thing but would also look for "b*a*d" and such.[/font]