you could check to see if there is a valid caracter before and/or after the
profanity, it Saturday would find turd then check back and find that there
is no space or full stop, and then check forward for the same.


Jason Lees 
National Express
Email : [EMAIL PROTECTED]


-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]]
Sent: 06 June 2001 13:56
To: CF-Talk
Subject: profanity checker(again)


Hi all,

I emailed the list regarding this a few weeks ago, but an interesting
problem has now come up.

I have some code that pulls a list of profanities from a db table, then
checks them against a form feild submitted by a user. Any words that match
are asterisked out. All well and good. But, when someone entered Saturday,
the code returned Sa****ay!! Yers, turd is in the database! What I want to
know is this. How would I look at changing this so that whilst turd would be
picked up and returned as ****, saturday is not??

Any ideas? Code is below.

TIA

Will

<cfset bodytext = Form.thread_body>

<cfset titletext = Form.thread_title>

 <!--- Pull out all the bad words from the database --->

<cfquery name="getprofanities" datasource="#APPLICATION.chatdsn#">
        SELECT ID, badword, rate1
        FROM tbl_profanity
</cfquery>

<!--- Loop over the profanity list and compare with words in the
bodytext --->

<cfloop query="getprofanities">

        <cfset bodytext = ReplaceNoCase(bodytext,
"#getprofanities.badword#",
"#getprofanities.rate1#", "ALL")>

        <cfset titletext = ReplaceNoCase(titletext,
"#getprofanities.badword#",
"#getprofanities.rate1#", "ALL")>

</cfloop>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to