Optimizing python link matching regular expression

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-05-31T18:38:01Z Indexed on 2010/05/31 18:43 UTC
Read the original article Hit count: 255

Filed under:
|

I have a regular expression, links = re.compile('<a(.+?)href=(?:"|\')?((?:https?://|/)[^\'"]+)(?:"|\')?(.*?)>(.+?)</a>',re.I).findall(data)

to find links in some html, it is taking a long time on certain html, any optimization advice?

One that it chokes on is http://freeyourmindonline.net/Blog/

© Stack Overflow or respective owner

Related posts about python

Related posts about regex