diff --git a/Lib/string.py b/Lib/string.py index 623eb0edab8..7371c915a13 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -101,10 +101,12 @@ def __getitem__(self, key): class _TemplateMetaclass(type): pattern = r""" - (?P%(delim)s{2}) | # Escape sequence of two delimiters - %(delim)s(?P%(id)s) | # delimiter and a Python identifier - %(delim)s{(?P%(id)s)} | # delimiter and a braced identifier - (?P%(delim)s) # Other ill-formed delimiter exprs + %(delim)s(?: + (?P%(delim)s) | # Escape sequence of two delimiters + (?P%(id)s) | # delimiter and a Python identifier + {(?P%(id)s)} | # delimiter and a braced identifier + (?P) # Other ill-formed delimiter exprs + ) """ def __init__(cls, name, bases, dct):