EmailDiscussions.com  

Go Back   EmailDiscussions.com > Email Service Provider-specific Forums > FastMail Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Stay in touch wirelessly

FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc.

Reply
 
Thread Tools
Old 14 Mar 2023, 05:45 AM   #16
JeremyNicoll
Essential Contributor
 
Join Date: Dec 2017
Location: Scotland
Posts: 431
Quote:
Originally Posted by xyzzy View Post
I'm testing for plus addressing ....
Yes, I understood the intent.

Quote:
Originally Posted by xyzzy View Post
In general the first backslash is "consumed" by the Sieve string scanner which passes what follows to the command.
Ahhh... Now I come to think of it I've seen Sieve use backslash to escape a double quote within a string (which is of course always enclosed in double quotes).


Looking back at the first RFC for Sieve, RFC3028, this is described. And interestingly it says that the only required Sieve parser escape sequences are backslash backslash, and backslash doublequote which I think means (unless a later RFC changed it) that

Quote:
Originally Posted by xyzzy View Post
... header :regex "X-Spam-score" "^5\.[6-9]$" ...
is actually correct. That is, the Sieve parser won't swallow that backslash because it's not followed by either another backslash or a double quote!

Or maybe not. The RFC also says: 'an undefined escape sequence (such as "\a" in a context where "a" has no special meaning) is interpreted as if there were no backslash (in this case, "\a" is just "a").' .... Which seems to me to be weird, because it seems to say that the escape character is elided in those situations, which means it IS being treated as an escape character and not a literal.

Last edited by JeremyNicoll : 14 Mar 2023 at 05:59 AM. Reason: added last paragraph to sow confusion
JeremyNicoll is offline   Reply With Quote
Old 14 Mar 2023, 11:05 AM   #17
xyzzy
Essential Contributor
 
Join Date: May 2018
Posts: 464
Quote:
Originally Posted by JeremyNicoll View Post
Code:
Originally Posted by xyzzy
...header :regex "X-Spam-score" "^5\.[6-9]$")...
is actually correct. That is, the Sieve parser won't swallow that backslash because it's not followed by either another backslash or a double quote!

Or maybe not. The RFC also says: 'an undefined escape sequence (such as "\a" in a context where "a" has no special meaning) is interpreted as if there were no backslash (in this case, "\a" is just "a").' .... Which seems to me to be weird, because it seems to say that the escape character is elided in those situations, which means it IS being treated as an escape character and not a literal.
Look at it this way; for Sieve (and many other languages, e.g., C, C++, etc.) the backslash is always considered as the "escape character" indicating the character that follows it may have special meaning. If it doesn't the character that follows is used as-is.

So if you are a "purist" then that "^5\.[6-9]$" is incorrect but it's just not worth the ticket pestering FM about it since that '.' in the context of this regular expression for the spam score will match any character there but it's always going to be a '.' anyhow since FM always formats the spam score correctly.
xyzzy is offline   Reply With Quote
Old 25 Mar 2023, 06:05 AM   #18
SideshowBob
Essential Contributor
 
Join Date: Jan 2017
Posts: 257
Quote:
Originally Posted by xyzzy View Post
So if you are a "purist" then that "^5\.[6-9]$" is incorrect but it's just not worth the ticket pestering FM about it
It doesn't matter in this case, but people might use it as an example in their own code.
SideshowBob is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +9. The time now is 11:55 PM.

 

Copyright EmailDiscussions.com 1998-2022. All Rights Reserved. Privacy Policy