From 3bf5ce5776362d0630c06d9481df68a72851d7be Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 26 Dec 2022 09:02:00 -0700 Subject: [PATCH] Fix TexMobject.select_unisolated_substring for substrings with escape characters --- manimlib/mobject/svg/string_mobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manimlib/mobject/svg/string_mobject.py b/manimlib/mobject/svg/string_mobject.py index 71f2b6b9..9445601f 100644 --- a/manimlib/mobject/svg/string_mobject.py +++ b/manimlib/mobject/svg/string_mobject.py @@ -561,7 +561,7 @@ class StringMobject(SVGMobject, ABC): def select_unisolated_substring(self, substr: str) -> VGroup: result = [] - for match in re.finditer(substr.replace("\\", r"\\"), self.string): + for match in re.finditer(re.escape(substr), self.string): index = match.start() start = self.substr_to_path_count(self.string[:index]) end = start + self.substr_to_path_count(substr)