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

Góra strony
Delete this message
Reply to this message
Autor: exim-users
Data:  
Dla: exim-users
Temat: Re: [exim] Is there a regex escape function?
On 03/10/12 16:36, exim-users@??? wrote:

>> "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.
>
> Proof of the above:
>
> mike@ung:~$ exim -be '${if
> match{4.76}{^\\Q$version_number\\E\$}{true}{false}}' true
> mike@ung:~$ exim -be '${if
> match{4X76}{^\\Q$version_number\\E\$}{true}{false}}' false
> mike@ung:~$


For the sake of completeness, you *can* disable expansion in regular
expressions in Exim, by wrapping the whole thing in \N's:

mike@ung:~$ exim -be '${if match{4.76}{\N^\Q4.76\E$\N}{true}{false}}'
true
mike@ung:~$ exim -be '${if match{4X76}{\N^\Q4.76\E$\N}{true}{false}}'
false
mike@ung:~$

So, while this works:

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

This wouldn't:

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

- -- 
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