Reputation: 400
Why re.search can't find the pattern?
str = "<a href='http://'>\ntest\n'</a>"
re.search(r"<a[^>]+>.", str, re.MULTILINE)
Upvotes: 2
Views: 553
Reputation: 304137
.
won't match a newline unless you use re.DOTALL
mystr = "<a href='http://'>\ntest\n'</a>"
re.search(r"<a[^>]+>.", mystr, re.MULTILINE|re.DOTALL)
Upvotes: 6