re.findall() hangs in python

silverburgh.meryl at gmail.com silverburgh.meryl at gmail.com
Sat Mar 31 23:12:56 EDT 2007


Hi,

I have the following regular expression.
It works when 'data' contains the pattern and I see 'match2' get print
out.
But when 'data' does not contain pattern, it just hangs at
're.findall'

pattern = re.compile("(.*)<img (.*?) src=\"(.*?)img(.*?)\"(.*?)",
re.S)

        print "before find all"

        match = re.findall(pattern, data)

        if (match):
           print "match2"



Can you please tell me why it that?




More information about the Python-list mailing list