From df5febf6e7a75d38e048f76525d92723b0fbd3f3 Mon Sep 17 00:00:00 2001 From: kkthxbye-code Date: Tue, 17 Jan 2023 18:16:10 +0100 Subject: [PATCH] Add re.escape to highlight_string --- netbox/utilities/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/utils.py b/netbox/utilities/utils.py index 38a974036..15275f858 100644 --- a/netbox/utilities/utils.py +++ b/netbox/utilities/utils.py @@ -517,7 +517,7 @@ def highlight_string(value, highlight, trim_pre=None, trim_post=None, trim_place """ # Split value on highlight string try: - pre, match, post = re.split(fr'({highlight})', value, maxsplit=1, flags=re.IGNORECASE) + pre, match, post = re.split(fr'({re.escape(highlight)})', value, maxsplit=1, flags=re.IGNORECASE) except ValueError: # Match not found return escape(value)