gready regex bastard :)

This commit is contained in:
Miroslav Stampar 2010-11-24 12:01:36 +00:00
parent 9579a97039
commit b2b521fc8a

View File

@ -1539,7 +1539,7 @@ def extractErrorMessage(page):
retVal = None
if isinstance(page, basestring):
for regex in (r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s+(?P<result>.+)<br\s*/?\s*>", r"<li>Error Type:<br>(?P<result>.+?)</li>"):
for regex in (r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s+(?P<result>.+?)<br\s*/?\s*>", r"<li>Error Type:<br>(?P<result>.+?)</li>"):
match = re.search(regex, page, re.DOTALL | re.IGNORECASE)
if match:
retVal = htmlunescape(match.group("result")).replace("<br>", "\n").strip()