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


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to