Also strip \r from marked text

This commit is contained in:
Kovid Goyal
2021-07-19 18:12:29 +05:30
parent 3633049ba5
commit 93e3e4d2b1

View File

@@ -310,7 +310,7 @@ def mark(pattern: str, post_processors: Iterable[PostprocessorFunc], text: str,
except InvalidMatch: except InvalidMatch:
continue continue
mark_text = text[s:e].replace('\n', '').replace('\0', '') mark_text = re.sub('[\r\n\0]', '', text[s:e])
yield Mark(idx, s, e, mark_text, groupdict) yield Mark(idx, s, e, mark_text, groupdict)