diff --git a/app/utils.py b/app/utils.py
index d73efe3e..4cfb7288 100644
--- a/app/utils.py
+++ b/app/utils.py
@@ -285,11 +285,11 @@ def allowlist_html(html: str, a_target='_blank') -> str:
clean_html = re_strikethough.sub(r'\1', clean_html)
# replace subscript markdown left in HTML
- re_subscript = re.compile(r'~(.*)~')
+ re_subscript = re.compile(r'~(\S+)~')
clean_html = re_subscript.sub(r'\1', clean_html)
# replace superscript markdown left in HTML
- re_superscript = re.compile(r'\^(.*)\^')
+ re_superscript = re.compile(r'\^(\S+)\^')
clean_html = re_superscript.sub(r'\1', clean_html)
return clean_html