Saturday 17 August 2013

Regex expression returns nothing. Why?

Regex expression returns nothing. Why?

This returns nothing?
# Enter your code for "Image Extractor" here.
import re
with open('site.html') as html:
content = html.read()
content = str(content)
print(re.findall(r'<ima?ge?\s+[^>]*?src=["|\']([^["|\']]+)', content))
I think it has something to do with me escaping the backslash from the
expression...

No comments:

Post a Comment