Skip to content

Commit 1172d02

Browse files
Nikki1993hugovk
andauthored
gh-110383: Added explanation about simplest regex use case for quantifiers. (#111110)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
1 parent 88bac5d commit 1172d02

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Doc/howto/regex.rst

+3
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ You can omit either *m* or *n*; in that case, a reasonable value is assumed for
245245
the missing value. Omitting *m* is interpreted as a lower limit of 0, while
246246
omitting *n* results in an upper bound of infinity.
247247

248+
The simplest case ``{m}`` matches the preceding item exactly **m** times.
249+
For example, ``a/{2}b`` will only match ``'a//b'``.
250+
248251
Readers of a reductionist bent may notice that the three other quantifiers can
249252
all be expressed using this notation. ``{0,}`` is the same as ``*``, ``{1,}``
250253
is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's better to use

0 commit comments

Comments
 (0)