A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033729.html below:

Some questions about maintenance of the regular expression code.

[Python-Dev] Re: Some questions about maintenance of the regular expression code. [Python-Dev] Re: Some questions about maintenance of the regular expression code.A.M. Kuchling amk@amk.ca
Wed, 26 Feb 2003 13:34:34 -0500
M.-A. Lemburg wrote:
> Hmm, could you explain where ".*?" is useful ?

The most common example comes from writing a regex to match bits of 
HTML.  If you have a pattern like this:

   <a href="([^"]*)"> (.*) </a>

and your input text is

    <a href="a">blah</a> <a href="b">blah</a>,

group 2 in the pattern will match 'blah</a> <a href="b">blah', which is 
not the link text that you want.  If you write .*?,
then group 2 matches just "blah", which is more useful.

--amk                                                    (www.amk.ca)
Ominous, isn't it?
       -- The Doctor, in "The Awakening"





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4