]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110383: Added explanation about simplest regex use case for quantifiers. (#111110)
authorNick <Nikki1993@users.noreply.github.com>
Mon, 23 Oct 2023 07:22:17 +0000 (10:22 +0300)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 07:22:17 +0000 (10:22 +0300)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Doc/howto/regex.rst

index c19c48301f58487fdc0e1a9c8eb93347b2db2b52..15372e74d6fedf9207bfc466c2cf501232c9999a 100644 (file)
@@ -245,6 +245,9 @@ You can omit either *m* or *n*; in that case, a reasonable value is assumed for
 the missing value.  Omitting *m* is interpreted as a lower limit of 0, while
 omitting *n* results in an upper bound of infinity.
 
+The simplest case ``{m}`` matches the preceding item exactly **m** times.
+For example, ``a/{2}b`` will only match ``'a//b'``.
+
 Readers of a reductionist bent may notice that the three other quantifiers can
 all be expressed using this notation.  ``{0,}`` is the same as ``*``, ``{1,}``
 is equivalent to ``+``, and ``{0,1}`` is the same as ``?``.  It's better to use