A better RE?

Magnus Lycka lycka at carmen.se
Thu Mar 9 14:41:06 EST 2006


I want an re that matches strings like "21MAR06 31APR06 1236",
where the last part is day numbers (1-7), i.e it can contain
the numbers 1-7, in order, only one of each, and at least one
digit. I want it as three groups. I was thinking of

r"(\d\d[A-Z]\d\d) (\d\d[A-Z]\d\d) (1?2?3?4?5?6?7?)"

but that will match even if the third group is empty,
right? Does anyone have good and not overly complex RE for
this?

P.S. I know the "now you have two problems reply..."



More information about the Python-list mailing list