]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #27800: Document limitation and workaround for multiple RE repetitions
authorMartin Panter <vadmium+py@gmail.com>
Sat, 15 Oct 2016 01:18:16 +0000 (01:18 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 15 Oct 2016 01:18:16 +0000 (01:18 +0000)
Doc/library/re.rst

index 569b5223323f8f8c6c1502760941657a5ebeaf65..1ca621eca6adee9cd8f50dec04b705c58890c6d4 100644 (file)
@@ -79,6 +79,12 @@ how the regular expressions around them are interpreted. Regular
 expression pattern strings may not contain null bytes, but can specify
 the null byte using a ``\number`` notation such as ``'\x00'``.
 
+Repetition qualifiers (``*``, ``+``, ``?``, ``{m,n}``, etc) cannot be
+directly nested. This avoids ambiguity with the non-greedy modifier suffix
+``?``, and with other modifiers in other implementations. To apply a second
+repetition to an inner repetition, parentheses may be used. For example,
+the expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters.
+
 
 The special characters are: