A better RE?

Eddie Corns eddie at holyrood.ed.ac.uk
Fri Mar 10 07:27:07 EST 2006


Magnus Lycka <lycka at carmen.se> writes:

>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

Just a small point - what does "in order" mean here? if it means that eg 1362
is not valid then you're stuck because it's context sensitive and hence not
regular.

I can't see how any of the fancy extensions could help here but maybe I'm just
lacking insight.

Now if "[\1-7]" worked you'd be home and dry.

Eddie



More information about the Python-list mailing list