How to write this regular expression?

could ildg could.net at gmail.com
Wed May 4 02:52:04 EDT 2005


I need a regular expression to check if a string matches it.
The string consists of one to there parts, each parts is a underline
followed by a number,
and the number of the first part should be 0~31, and numbers of other
parts should be
larger than 31.

The requested re should match the following strings:
_3
_5_33
_21
_29_50
_29_700_700000

And the re shouldn't match the following strings:
_3_5   the number of part 2 is less than 31
_43    the number of part 1 shouldn't be less than 31
_5_43_69_98  there shouldn't be more than 3 parts

How to write the re, please?
Thanks in advance.



More information about the Python-list mailing list