diff options
author | 谭九鼎 <109224573@qq.com> | 2022-04-05 09:08:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-05 09:08:00 (GMT) |
commit | faa12088c179dd896fde713448a7f142f820c1aa (patch) | |
tree | 0ff44b6a1e8ef0e1239aa4bc56c27027ce268532 /Doc | |
parent | d0e696e05d4aaca1f1cde72a5c3326ca3d0f5c24 (diff) | |
download | cpython-faa12088c179dd896fde713448a7f142f820c1aa.zip cpython-faa12088c179dd896fde713448a7f142f820c1aa.tar.gz cpython-faa12088c179dd896fde713448a7f142f820c1aa.tar.bz2 |
chore/docs: fix rst style and typo (GH-32331)
Current:
![图片](https://user-images.githubusercontent.com/24759802/161704413-30fc91e8-ccd1-4617-8483-bc54ec970f30.png)
After this change:
![图片](https://user-images.githubusercontent.com/24759802/161704636-a5458192-a93a-40af-8bde-90ba80fdb53f.png)
Trivial so I don't think it needs news or issue
Automerge-Triggered-By: GH:JulienPalard
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/re.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index b72d72f..89de928 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -166,15 +166,15 @@ The special characters are: back-tracking when the expression following it fails to match. These are known as :dfn:`possessive` quantifiers. For example, ``a*a`` will match ``'aaaa'`` because the ``a*`` will match - all 4 ``'a'``s, but, when the final ``'a'`` is encountered, the + all 4 ``'a'``\ s, but, when the final ``'a'`` is encountered, the expression is backtracked so that in the end the ``a*`` ends up matching - 3 ``'a'``s total, and the fourth ``'a'`` is matched by the final ``'a'``. + 3 ``'a'``\ s total, and the fourth ``'a'`` is matched by the final ``'a'``. However, when ``a*+a`` is used to match ``'aaaa'``, the ``a*+`` will match all 4 ``'a'``, but when the final ``'a'`` fails to find any more characters to match, the expression cannot be backtracked and will thus fail to match. ``x*+``, ``x++`` and ``x?+`` are equivalent to ``(?>x*)``, ``(?>x+)`` - and ``(?>x?)`` correspondigly. + and ``(?>x?)`` correspondingly. .. versionadded:: 3.11 @@ -208,10 +208,10 @@ The special characters are: *without* establishing any backtracking points. This is the possessive version of the quantifier above. For example, on the 6-character string ``'aaaaaa'``, ``a{3,5}+aa`` - attempt to match 5 ``'a'`` characters, then, requiring 2 more ``'a'``s, + attempt to match 5 ``'a'`` characters, then, requiring 2 more ``'a'``\ s, will need more characters than available and thus fail, while - ``a{3,5}aa`` will match with ``a{3,5}`` capturing 5, then 4 ``'a'``s - by backtracking and then the final 2 ``'a'``s are matched by the final + ``a{3,5}aa`` will match with ``a{3,5}`` capturing 5, then 4 ``'a'``\ s + by backtracking and then the final 2 ``'a'``\ s are matched by the final ``aa`` in the pattern. ``x{m,n}+`` is equivalent to ``(?>x{m,n})``. |