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

Means, Eric D eric.d.means at boeing.com
Thu Jun 13 08:45:00 CDT 2002


>  -----Original Message-----
> From: 	cspruck at mindspring.com [mailto:cspruck at mindspring.com]
> Sent:	Wednesday, June 12, 2002 6:54 PM
> To:	thelist at lists.evolt.org
> Subject:	Re: [thelist] pattern match three or more of the same
character repeated in a row
>
>
>
> On Wed, 12 Jun 2002 13:59:54 -0700 (PDT) Julie O'Neil
<julievoneil at yahoo.com> wrote:
>
> I need to match if a given string contains three or more of the same
character repeated in a row.
> ------------------------------------------------
>
> Julie,
>
> Something along the lines of this should work for you:
>
> [a-zA-Z0-9]{3,}

While this will match 3 characters, it *won't* match the *same* character
repeated three times.  The OP wanted to match these: aaa bbb xxx zzz but not
these: aab xea drf.  As I read the question, anyway.

Unfortunately I don't have an answer.  If you're using Perl you'll have to
use some sort of look-ahead or look-behind... read the regex man page here:
http://www.perldoc.com/perl5.6.1/pod/perlre.html for more info.



More information about the thelist mailing list