From 4af95d95cdf01071ecb2582aebafeecc948bc88c Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Fri, 15 Dec 2023 16:31:19 +0100 Subject: [PATCH] Use raw strings to fix invalid escape The replacement string contains `\g`, which is an invalid escape in Python (and not supposed to be a python escape). --- bibtexparser/latexenc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bibtexparser/latexenc.py b/bibtexparser/latexenc.py index c6a2cfbc..d5949234 100644 --- a/bibtexparser/latexenc.py +++ b/bibtexparser/latexenc.py @@ -90,7 +90,7 @@ def protect_uppercase(string): :param string: string to convert :returns: string """ - string = re.sub('([^{]|^)([A-Z])([^}]|$)', '\g<1>{\g<2>}\g<3>', string) + string = re.sub(r'([^{]|^)([A-Z])([^}]|$)', r'\g<1>{\g<2>}\g<3>', string) return string