[Python-checkins] cpython (2.7): Clarify greedy-qualifier example, avoid HTML.
georg.brandl
python-checkins at python.org
Tue Apr 12 01:53:02 EDT 2016
https://hg.python.org/cpython/rev/c2f57f959c05
changeset: 100939:c2f57f959c05
branch: 2.7
parent: 100936:16a27e38e9b5
user: Georg Brandl <georg at python.org>
date: Tue Apr 12 07:51:41 2016 +0200
summary:
Clarify greedy-qualifier example, avoid HTML.
files:
Doc/library/re.rst | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -108,11 +108,11 @@
``*?``, ``+?``, ``??``
The ``'*'``, ``'+'``, and ``'?'`` qualifiers are all :dfn:`greedy`; they match
as much text as possible. Sometimes this behaviour isn't desired; if the RE
- ``<.*>`` is matched against ``'<H1>title</H1>'``, it will match the entire
- string, and not just ``'<H1>'``. Adding ``'?'`` after the qualifier makes it
+ ``<.*>`` is matched against ``<a> b <c>``, it will match the entire
+ string, and not just ``<a>``. Adding ``?`` after the qualifier makes it
perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few*
- characters as possible will be matched. Using ``.*?`` in the previous
- expression will match only ``'<H1>'``.
+ characters as possible will be matched. Using the RE ``<.*?>`` will match
+ only ``<a>``.
``{m}``
Specifies that exactly *m* copies of the previous RE should be matched; fewer
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list