Re: [exim] Is there a regex escape function?

Startseite
Nachricht löschen
Nachricht beantworten
Autor: exim-users
Datum:  
To: exim-users
Betreff: Re: [exim] Is there a regex escape function?
On 03/10/12 16:07, Lena@??? wrote:

>> In perl style regular expressions, \Q disables pattern
>> meta-characters until \E is reached.
>
> But Exim uses PCRE. From `man pcrepattern`:
>
> If you want to remove the special meaning from a sequence of
> charac- ters, you can do so by putting them between \Q and \E. This
> is differ- ent from Perl in that $ and @ are handled as
> literals in \Q...\E sequences in PCRE, whereas in Perl, $ and @
> cause variable interpola- tion. Note the following examples:
>
> Pattern            PCRE matches   Perl matches

>
> \Qabc$xyz\E        abc$xyz        abc followed by the contents of
> $xyz


"By perl style regular expressions" I was referring to PCRE. Yes, Perl
does variable interpolation before running the regex, but then Exim
does string expansion before running the regex as well.

I'm not sure what you're getting at. Do you think there was a bug in
the suggestion I made of using:

${if match {$h_X-UoP-Loop:}{^\\Q$sender_address \\E}}

Because in the above, $sender_address is first expanded to the real
email address, and then any pattern meta-chars in that email address
are treated as normal chars...

Looks good to me.

- -- 
Mike Cardwell  https://grepular.com/     http://cardwellit.com/
OpenPGP Key    35BC AF1D 3AA2 1F84 3DC3  B0CF 70A5 F512 0018 461F
XMPP OTR Key   8924 B06A 7917 AAF3 DBB1  BF1B 295C 3C78 3EF1 46B4