It's not a look ahead or a look behind.. I am not sure what the technical term. I think it's just a "back reference". The "\1" in the regular expression is just a back reference to the first group as denoted by "(" and ")".
Maybe someone else here can help with the actual name. ...................... Ben Nadel Certified Advanced ColdFusion Developer www.bennadel.com -----Original Message----- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 03, 2006 4:31 PM To: CF-Talk Subject: RE: Preventing long strings of one character Well now. That was easy enough. So using lookaheads? Thank you Ben. <!----------------//------ andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --------------//---------> -----Original Message----- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 03, 2006 3:27 PM To: CF-Talk Subject: RE: Preventing long strings of one character 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:255267 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4