[MERGE] squid proxies use boundary="foo"

Michael Ellerman michael at ellerman.id.au
Fri Sep 1 03:58:20 BST 2006


On 9/1/06, Martin Pool <mbp at canonical.com> wrote:
> On  1 Sep 2006, Jelmer Vernooij <jelmer at samba.org> wrote:
> > On Fri, 2006-09-01 at 10:48 +1000, Martin Pool wrote:
> > > On  1 Sep 2006, Michael Ellerman <michael at ellerman.id.au> wrote:
> > > Why do we have the odd construction (.*?) ?  Surely the '?' is
> > > redundant?
> > At least in perl-compatible regexes, this means "match as less as possible" rather than "match as much as possible", the default.
>
> You're right.

Yep, otherwise the .* will eat whitespace, eg:

>>> p = re.compile('^(.*)(\s*)$')
>>> m = p.match('foobar  ')
>>> print m.groups()
('foobar  ', '')
>>> p = re.compile('^(.*?)(\s*)$')
>>> m = p.match('foobar  ')
>>> print m.groups()
('foobar', '  ')


cheers




More information about the bazaar mailing list