On 27 Apr 2018, at 16:27, Joëlle Pfeffer wrote:
Hi David,
Thank you for your answer.
I don't think I have to escape the @ character.
Yes, you do, if you want to match a character following it that could be
the first character in an unreserved variable name (letter or
underscore) or is an existing Perl special variable. The reason '@.'
works unescaped is that it cannot be a user-defined variable and it
isn't a Perl special variable, so Perl does not parse it as an array
variable.
It is recognized without being escaped since
when my rule is : From:name =~ /@.b/i
the display names consisting of @Ab or @Abc hit.
It seems as if the character following the @ is not recognized except
if it is a full stop.
No. You just happened to test a character after the unescaped @ that
isn't the first character of the name of any special Perl variable and
can't be the first character of a user-defined variable name. It would
also work with digits and most other symbols.
SpamAssassin rules also must escape $ or %, which are the other
characters Perl uses before variable names to indicate that they are
variable names.
--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Currently Seeking Steady Work: https://linkedin.com/in/billcole