Help with regular expression using findall and .*?

czrpb nanotech at europa.com
Thu Sep 12 16:29:21 EDT 2002


Could anyone help out with rewriting (still using regular expressions)
the following so that it does not cause an exception:

import re

s1=('macro\n'+'a'*200+'\norcam\n')*10
s2=('macro\n'+'a'*20000+'\norcam\n')*10

p=re.compile(r'macro.*?orcam',re.DOTALL)

for x in re.findall(p,s1):
    print x

for x in re.findall(p,s2):
    print x

thanks!! Quentin Crain


-------------------------------------------------------------------------
I think we are miscommunicating. I actually expected some confusion with
my last response and I am not sure if there actually was some, but I feel
like it. So, my message is going to assume I did not make my points, but
perhaps you did understand me. If so, then that means *I* did not
understand *YOUR* response - in which case you will need to rephrase.







More information about the Python-list mailing list