diff options
author | Georg Brandl <georg@python.org> | 2016-04-12 05:51:41 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2016-04-12 05:51:41 (GMT) |
commit | 7ff033bd6251625ef6da4ab9ec6259c34fbf3f8d (patch) | |
tree | f668ef77c770fe3e57c1ea9dd043acd8a7617f40 /Doc | |
parent | 247763d64e4d56ad1cd3bb33e34d1af0048a68ed (diff) | |
download | cpython-7ff033bd6251625ef6da4ab9ec6259c34fbf3f8d.zip cpython-7ff033bd6251625ef6da4ab9ec6259c34fbf3f8d.tar.gz cpython-7ff033bd6251625ef6da4ab9ec6259c34fbf3f8d.tar.bz2 |
Clarify greedy-qualifier example, avoid HTML.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/re.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 75059cd..1df768c 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -113,11 +113,11 @@ The special characters are: ``*?``, ``+?``, ``??`` 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 |