diff --git a/app/utils/results.py b/app/utils/results.py index 7269ca7..c6af2cc 100644 --- a/app/utils/results.py +++ b/app/utils/results.py @@ -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"\1",element,flags=re.I) + re.sub(fr"\b[^-<>{{}}]({target_word})\b",r" \1",element,flags=re.I) ) # Split all words out of query, grouping the ones wrapped in quotes