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)