]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-110383: Added explanation about simplest regex use case for quantifiers...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 23 Oct 2023 07:31:32 +0000 (09:31 +0200)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 07:31:32 +0000 (07:31 +0000)
Co-authored-by: Nick <Nikki1993@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Doc/howto/regex.rst

index 8d95d86ba398b6fc3554d1f46158fc076a5fefce..2cc17b4f745cb6091ced0e8e1a365c627c204cf5 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