Skip to content

Commit

Permalink
[3.11] gh-110383: Added explanation about simplest regex use case for…
Browse files Browse the repository at this point in the history
… quantifiers. (GH-111110) (#111205)

Co-authored-by: Nick <Nikki1993@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 23, 2023
1 parent 3c3c489 commit 6020a3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Doc/howto/regex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6020a3e

Please sign in to comment.