[thelist] pattern match three or more of the same character repeated in a row

cspruck at mindspring.com cspruck at mindspring.com
Thu Jun 13 09:49:01 CDT 2002


*************************************************
  cspruck at mindspring.com wrote:

Julie,

Something along the lines of this should work for you:

[a-zA-Z0-9]{3,}

O'Neil <julievoneil at yahoo.com> wrote:

 Nope doesn't work - it does catch a word that contains three repeated characters but it also catches ANY word.
*************************************************

Julie,

My apologies for the flub - I got interrupted several times while trying to reply and lost sight of what you were trying to do.

You still haven't told us what you're using for regex, so this may or may not work depending on your variation of regex. Something close to what Matt suggested worked for me in ColdFusion Studio:

([a-zA-Z0-9])\1{2}

The range within parentheses grabs a single character, then the backreference (the \1) recalls it once, then finds two more. A lot depends on what you're searching against, too. You can find three consecutive letters within a word, but the expression might be different for a single three-letter word if that's what you're trying to grab. Hope this is more help!

Chris



More information about the thelist mailing list