Quote:
Originally Posted by JamesHenderson
Thanks, xyzzy.
I got the gist of your code (thanks). but my question was specifically why two slahes were needed in succession. I can see that Fastmail translates my single slash into two, but why? ...I cannot see any reference to double-shlashing having a special meaning in regex (it seems to me that the first slash escapes the second slash).
|
It's because the escaping is happening at two separate levels.
In sieve a \ is used to escape the double quote character that's normally the string delimiter, and a literal \ itself has to be escaped as \\. Other backslashes are ignored. This is done before the regex string is passed to the regex library.