Stupid Regex Question

Fredrik Lundh fredrik at pythonware.com
Wed Apr 21 13:21:16 EDT 2004


Jonas Galvez wrote:

> But now I'm puzzled. What is that '?' doing, exactly?
>
> Could you point me any references?

look for "*?" on this page:

    http://www.python.org/doc/current/lib/re-syntax.html

also note that on some Python versions, "*?" may run out of stack
space if the distance between <tag> and </tag> is very large.  it's
sometimes better to two separate searches: start by searching for
the start tag, and then search for the end tag, starting at the end of
the first match.  both the string's "find" method and regular expression
"search" method takes optional start arguments; see the docs for
details.

</F>

</F>







More information about the Python-list mailing list