Clarify greedy-qualifier example, avoid HTML.

This commit is contained in:
Georg Brandl 2016-04-12 07:51:41 +02:00
parent 997a1c88a8
commit 5892ab1b4a
1 changed files with 4 additions and 4 deletions

View File

@ -108,11 +108,11 @@ The special characters are:
``*?``, ``+?``, ``??`` ``*?``, ``+?``, ``??``
The ``'*'``, ``'+'``, and ``'?'`` qualifiers are all :dfn:`greedy`; they match The ``'*'``, ``'+'``, and ``'?'`` qualifiers are all :dfn:`greedy`; they match
as much text as possible. Sometimes this behaviour isn't desired; if the RE 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 ``<.*>`` is matched against ``<a> b <c>``, it will match the entire
string, and not just ``'<H1>'``. Adding ``'?'`` after the qualifier makes it string, and not just ``<a>``. Adding ``?`` after the qualifier makes it
perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few* perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few*
characters as possible will be matched. Using ``.*?`` in the previous characters as possible will be matched. Using the RE ``<.*?>`` will match
expression will match only ``'<H1>'``. only ``<a>``.
``{m}`` ``{m}``
Specifies that exactly *m* copies of the previous RE should be matched; fewer Specifies that exactly *m* copies of the previous RE should be matched; fewer