problem with re

John Hunter jdhunter at nitace.bsd.uchicago.edu
Thu Sep 6 13:41:26 EDT 2001


>>>>> "Patrick" == Patrick Vrijlandt <p.vrijlandt at aig.azn.nl> writes:

    Patrick> Hi, I do not understand why the 7th regular expression
    Patrick> does not give the same result as 2-6.

Did you mean to do this perhaps:

mymatch(r'\n'.join([r'(\d{10}|[a-z]{10})', r'([a-z]{10})',r'(\d{10})']))

This matches.  You put an extra grouping operator in; ie,

(A)|(B) versus (A|B)

Hope this helps,
John Hunter 



More information about the Python-list mailing list