Re: [Exim] Grouping allowed in system filter pcre?

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Sheldon Hearn
CC: exim-users
Subject: Re: [Exim] Grouping allowed in system filter pcre?
On Fri, 16 Aug 2002, Sheldon Hearn wrote:

> I'd love non-interpolating single-quotes, which would allow
>
>    if $recipients matches '\b(sheldonh|root)@starjuice\.net\b'


No, it wouldn't. Remember, the data is also *expanded*. You'd need

       if $recipients matches '\\b(sheldonh|root)@starjuice\\.net\\b'
or
       if $recipients matches '\N\b(sheldonh|root)@starjuice\.net\b'


> As an aside, what's \N for? I've never used it in perl, whence cometh
> PCRE.


\N is not a regex-ism. It's a feature of Exim 4 string expansion that
says "don't expand stuff between \Ns". Thus, it is highly useful for
wrapping regexs.

> Of course, it'd trip up the inexperienced, because this would never
> match:
>
>    if $recipients is '$recipients'

>
> But I don't think that's a strong case for excluding it from the Wish
> List. :-)


Hmm. That example is, sadly, a good case NOT to do it with that syntax.

What? Have I gone mad? I hope not:

What I was suggesting was non-*escaping* quotes, not non-*interpolating*
quotes, as a way of not escaping \ in strings. If I were to use ' as
suggested, there would be no difference between '$recipients' and
"$recipients" because neither string contains a backslash. Exim's string
expansion (which recognizes dollars) happens later. [And actually,
$recipients is a bad example, because is isn't really a variable.]

I fear that if I use ' for this, it will confuse Perl and Shell users.

I need to think of some other syntax. However, doing *anything* might
break existing configurations and filters, so I'm exceedingly cautious.
This really only matters for regular expressions, and the users of those
are generally "sophisticated"... :-)

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