[docs] Tiny doc bug

Robert Kinstler r_kinstler at comcast.net
Tue Apr 23 23:02:34 CEST 2013


In http://docs.python.org/2/library/re.html I think that the last
regular expression in the paragraph quoted below is missing the '<' and
'>'.  It is supposed to be the non-greedy version of "<.*>", right?  (I
am writing my string literals as they are written in "C" source code.)

The '*', '+', and '?' qualifiers are all /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 perform the
match in /non-greedy/ or /minimal/ fashion; as /few/ characters as
possible will be matched. Using .*? in the previous expression will
match only '<H1>'.

Thanks for reading this.

Robert Kinstler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130423/f612b9df/attachment-0001.html>


More information about the docs mailing list