Author: Ross Boylan Date: To: exim-users CC: Andreas Metzler, 233927-forwarded, Ross Boylan Subject: Re: [Exim] Re: Bug#233927: exim4-doc-info: clarify meaning of "matches"
[Andreas, forward to Philip if you think appropriate. I notice his
edress didn't appear when I said reply all, which is perhaps
significant. Also, I left the bug number with -forward, though I'm
not sure what that does.]
On Wed, Feb 25, 2004 at 10:44:44AM +0000, Philip Hazel wrote: > On Tue, 24 Feb 2004, Andreas Metzler wrote:
>
> > Filter:
> > -For a `matches' test, after expansion of both strings, the second one
> > -is interpreted as a regular expression. Exim uses the PCRE regular
> > -expression library, which provides regular expressions that are
> > -compatible with Perl.
> >
> > +A `matches' test expands both strings and interprets the second one as
> > +a regular expression. The match succeeds if the regular expression
> > +matches any part of the first string. Exim uses the Perl-compatible
> > +PCRE regular expression library.
>
> Unfortunately, that is also not true. If the regex starts with ^ it will
> match only at the start of the string; if it ends with $ it will match
> only at the end of the string. This is, of course, exactly compatible
> with Perl.
"The match succeeds if the regular expression matches any part of the
first string, unless restricted by ^ or $."?
I mentioned this as a possible problem in my original post. But I
think there's a trade-off; adding the qualifier makes the statement
more complex and harder to grasp. The substantive uncertainty I had
was whether regex "a" matches only "a", "a" and "ab" (roughly the
meaning of match in python), or anything with an "a" somewhere in it.
I'm not sure anyone will be confused about the semantics of ^ and $.
>
> > Perhaps a big fat note in chapter 8?
> > | In this document the term "a regular expression matches" refers
> > | to partial matching, i.e. the expression "oo" matches "foobar", it
> > | is not necessary to match the whole string with something like
> > | ".oo.*".
>
> I will try to explain better.
> Thanks.