I just added this feature to Inform (my forms management system) at the
weekend. Here is the code it uses. If there is something in FoundWordList
then the field is rejected and FoundWordList is used in the error message.
<cfset FoundWordList = "">
<cfloop index="Word" list="#Attributes.LanguageList#">
<cfif
REFindNoCase("(^|[[:punct:][:space:]])#Word#($|[[:punct:][:space:]])",
This.Value)>
<cfset FoundWordList = ListAppend(FoundWordList, Word)>
</cfif>
</cfloop>
Regards,
Matthew Walker
New Zealand Tramper
http://www.matthewwalker.net.nz/
----- Original Message -----
From: "James" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, April 07, 2002 11:47 PM
Subject: Picking up swear words
> Hi all,
>
> I am trying to loop through a list of swear words and if any are found
then
> reject
> the insertion of a message in to the db.
>
> the problem i am having is that when the loop scans looking for "ass", it
also
> picks up "asset" and "massachusetts".
>
> is there any way of preventing this from happening?
>
> i started looking for:
>
> " " & ListWord & " "
>
> but then i realised that someone could put it at the end of
> a sentance and then it would need to be:
>
> " " & ListItem & "."
>
> as you can see, getting very messy very quickly....
> any tips would be muchly appreciated!!!
>
> thanks.
> James.
>
>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists