Re: [Exim] [root@charlotte.intern.cats.ms: Bug#53140: direct…

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: Kai Henningsen
Cc: exim-users
Asunto: Re: [Exim] [root@charlotte.intern.cats.ms: Bug#53140: director suffix option problem]
On Thu, 23 Mar 2000, Kai Henningsen wrote:

> ... have a look at this:
> $ perl -e '$x = "bla-blubb.nix"; $x =~ /(\..*|-.*)$/; print "matched
> <$&>\n";'
> matched <-blubb.nix>
> $
>
> This does _not_ match the first; it does match the longest.


Oooh, you are getting into the really complicated depths of regexes
here! When a regex is not anchored things can get messy.

Actually, it isn't the longest (though it happens to be). It is the
first that it actually finds. It tries the alternative \.. on the letter
"b", fails to match, so tries the next alternative -.* and fails on that
too. So the starting point is moved on one character to the letter "l"
and it tries again. You will see that the first thing that does match is
when it gets to the hyphen character - the rest of the regex then
matches.

I can give you another one that doesn't match the first *or* the
longest:

/(\..*$|-)/

Maybe I shouldn't have started this regex talk...

> > Return-path: <ph10@???>
> > Envelope-to: kai.henningsen-carmen@???
>
> (Incidentally, why does one use <> and not the other?)


Because the first can be <>

Philip

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.