change wildcard {} regex to allow escaping (#968)

This commit is contained in:
robo
2025-06-19 12:39:06 +09:00
committed by GitHub
parent 65f1363a10
commit 4c292e684e
+1 -1
View File
@@ -220,7 +220,7 @@ def process(text, seed=None):
replacements_found = True
return replacement
pattern = r'{([^{}]*?)}'
pattern = r'(?<!\\)\{((?:[^{}]|(?<=\\)[{}])*?)(?<!\\)\}'
replaced_string = re.sub(pattern, replace_option, string)
return replaced_string, replacements_found