From 9fddcf3057167592a9a2506e4dd4d23f2caca449 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Mon, 27 Sep 2021 00:50:25 -0700 Subject: [PATCH] Fix replacement of colon and exclamation outside of eval expression --- plexpy/notification_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 0f2155ad..406c2cda 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -1841,6 +1841,7 @@ class CustomFormatter(Formatter): def __init__(self, default='{{{0}}}'): self.default = default self.eval_regex = re.compile(r'`.*?`') + self.eval_replace_regex = re.compile(r'{.*(`.*?`).*}') self.eval_replace = { ':': '%%colon%%', '!': '%%exclamation%%' @@ -1893,7 +1894,7 @@ class CustomFormatter(Formatter): def parse(self, format_string): # Replace characters in eval expression - for match in re.findall(self.eval_regex, format_string): + for match in re.findall(self.eval_replace_regex, format_string): replaced = match for k, v in self.eval_replace.items(): replaced = replaced.replace(k, v)