Regex Help
Support Desk
support.desk.ipg at gmail.com
Mon Sep 22 12:37:46 EDT 2008
Anybody know of a good regex to parse html links from html code? The one I
am currently using seems to be cutting off the last letter of some links,
and returning links like
http://somesite.co
or http://somesite.ph
the code I am using is
regex = r'<a href=["|\']([^"|\']+)["|\']>'
page_text = urllib.urlopen('http://somesite.com')
page_text = page_text.read()
links = re.findall(regex, text, re.IGNORECASE)
More information about the Python-list
mailing list