Skip bolding search terms that are not alphanumeric (#496)

Fixes #494
pull/503/head
DUO Labs 3 years ago committed by GitHub
parent 1abd040428
commit d8dcdc7455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -52,6 +52,9 @@ def bold_search_terms(response: str, query: str) -> BeautifulSoup:
if len(element) == len(target_word):
return
if not target_word.isalnum():
return
element.replace_with(
re.sub(fr'\b((?![{{}}<>-]){target_word}(?![{{}}<>-]))\b',
r'<b>\1</b>',

Loading…
Cancel
Save