regex alternation problem

Jesse Aldridge JesseAldridge at gmail.com
Fri Apr 17 23:49:52 CEST 2009


import re

s1 = "I am an american"

s2 = "I am american an "

for s in [s1, s2]:
    print re.findall(" (am|an) ", s)

# Results:
# ['am']
# ['am', 'an']

-------

I want the results to be the same for each string.  What am I doing
wrong?



More information about the Python-list mailing list