[Tutor] regex newbie question
Dick Moores
rdm at rcblue.com
Thu May 8 23:40:16 CEST 2008
At 01:30 PM 5/8/2008, Steve Willoughby wrote:
>On Thu, May 8, 2008 12:40, Dick Moores wrote:
> > But here's a chance to ask: What regex would match 2-digit strings
> > and 4-digit strings only?
>
>^\d\d(\d\d)?$
Ah. And so ^\d\d(\d\d)?(\d\d)?$ matches all and only 2-, 4-, and
6-digit strings. Which makes me wonder if there's a regex for ALL
and only strings of digits only, with an even number of digits.
> > And another: What regex matches the "" string?
>
>^$
Oh, of course.
Thanks,
Dick
More information about the Tutor
mailing list