Fixed some other issues with the new regex system

This commit is contained in:
DUO Labs 2021-10-26 18:07:15 -04:00 committed by GitHub
parent fe8bfa655a
commit e29552fd11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,7 @@ def bold_search_terms(response: str, query: str) -> BeautifulSoup:
# Replace all instances of the word, but maintaining the same case in
# the replacement
element.replace_with(
re.sub(fr"\b({target_word})\b",r"<b>\1</b>",element,flags=re.I)
re.sub(fr"\b[^-<>{{}}]({target_word})\b",r"<b> \1</b>",element,flags=re.I)
)
# Split all words out of query, grouping the ones wrapped in quotes