I want to get www.target.com
and target
.
The following code works:
#coding: utf8
import re
info = '''<a href="www.target.com"> xxxxxx <span>target</span>'''
result = re.findall(r'<a href="(.*?)".+?<span>(.*?)</span>', info)
print result
But when I meet a str, with lot of return and char, like:
info = '''<a href="www.target.com"> # return here
xxxxxxxx # return here
xxxx # return here
xxxxxx <span>target</span>'''
In this situation, How can I get the link www.target.com
and word target
using regular expression in Python?