For (strKey in FORM){
        
FORM[ strKey ] = REReplaceNoCase(
   FORM[ strKey ],
   "([\w]{1})(\1{2,})",
   "\1",
   "ALL"
);

}


This gets the first group (which is any letter or digit) and checks to
see if that is followed by 2 or more instances of that letter. If so,
then it is replaced with a single version of that letter.

......................
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com
 

-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 03, 2006 4:20 PM
To: CF-Talk
Subject: Preventing long strings of one character

I'm building an email signup form for kids. Sometimes they (or their
adults) type in values with long strings of one letter:

ddddddddddddavid for example.

I'd like to loop over the form fields and check for any occurrence of
one character repeated more than 3 times. That should cover any legit
instance.
I'm guessing that this would be a cause for REReplaceNoCase, but I'm not
certain what the regex would be. Anyone have input? For simplicity's
sake, I'll just search for any letters or numbers.

So I want to find any occurrence of 4 or more letters or numbers in a
row. I was thinking that this should work, but it's matching whether
there's 3 or more letters in a row or not:

<cfset mystring = "waaaaaalt">

<cfif REFindNoCase("[0-9a-z]{3}",mystring)>
        hammer time
<cfelse>
        nada
</cfif>

I'm using CF 6.1

<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255261
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to