Fix #991380 (RegEx broken, Fatal Error Converting txt -> mobi)

This commit is contained in:
Kovid Goyal 2012-05-02 22:07:29 +05:30
parent 7aeb6157f6
commit cb4beb395a

View File

@ -179,7 +179,11 @@ class HeuristicProcessor(object):
for match in re.finditer(pat, search_text):
ital_string = str(match.group('words'))
#self.log.debug("italicising "+str(match.group(0))+" with <i>"+ital_string+"</i>")
try:
html = re.sub(re.escape(str(match.group(0))), '<i>%s</i>' % ital_string, html)
except OverflowError:
# match.group(0) was too large to be compiled into a regex
continue
return html