Warning: This answer may well be off topic
<soapbox=on mode="free speech">
Umm, are you sure about this? What if somebody says "I had to brush it off"? Will your software filter that? If you code it to avoid phrases like this, will you allow the "tithe"? How about "Shiite"?

I could likely sit here all day and come up with silly examples as to how this filtering scheme will filter more than you intended.

I could also show clever ways to still swear that most people would understand. I will not, however, profane the Monastery in that fashion.

What about historical references? How many of us, as we get ready to press the rest button and reinstall the server have shouted "damn the torpedoes, men!"? okay, I will admit I am likely to be in a minority on that one :)

My understanding is that most languages are far to context dependant for this kind of filter to work. I also freely admit this in no way helps answer your question, but I firmly believe there is no solution beyond compiling a list of Carlin's Seven Dirty Words and using a word boundary regex - like

/\bdamn\b/
Sorry 'bout that. We now return you to our regularly scheduled Monastery.
</soapbox>
Update: I really must stop trying to respond using Opera. mikfire

In reply to Re: Robust Anti-Swear script by mikfire
in thread Robust Anti-Swear script by Azhrarn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.