re.findall() hangs in python
gagsl-py2 at yahoo.com.ar
Sun Apr 1 03:58:43 EDT 2007
En Sun, 01 Apr 2007 03:58:51 -0300, Peter Otten <__peter__ at web.de>
> 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(.*?)\"(.*?)",
> Could it be that it is just slow? If not, post a small example of data
> provokes findall() to hang.
I bet it is very slooooooow!
To the OP: do you actually need all those groups? Specially the first and
last (.*), they match all the surrounding text.
More information about the Python-list