re.findall() hangs in python
__peter__ at web.de
Sun Apr 1 02:58:51 EDT 2007
silverburgh.meryl at gmail.com wrote:
> I have the following regular expression.
> It works when 'data' contains the pattern and I see 'match2' get print
> But when 'data' does not contain pattern, it just hangs at
> pattern = re.compile("(.*)<img (.*?) src=\"(.*?)img(.*?)\"(.*?)",
> print "before find all"
> match = re.findall(pattern, data)
> if (match):
> print "match2"
> Can you please tell me why it that?
Could it be that it is just slow? If not, post a small example of data that
provokes findall() to hang.
More information about the Python-list