On Mon, 21 Jul 1997, I wrote:
> On Mon, 14 Jul 1997, Tim Cutts wrote:
>
> > 1) I am trying to restrict the checking to mail messages sent from
> > machines in .com and .net, so I tried the following:
> >
> > if $sender_host_name: matches "\\.(com|net)\\$"
> > ...
> >
> > but this never seems to match anything. Have I made some stupid error
> > here?
>
> You shouldn't have the \\ before the $.
Sorry, I lied. Brain not in gear after being away. The use of \ is
particularly awkward for "matches" because it gets interpreted on 3
levels:
(1) If the string is in quotes, one level is stripped away by the normal
quoted string processing;
(2) The string is then expanded, which removes another layer of \;
(3) Interpretation of regular expressions also looks for \.
Thus you should really have
if $sender_host_name: matches "\\\\.(com|net)\\$"
but it would be simpler to write
if $sender_host_name: matches \\.(com|net)\$
since there is no whitespace in the string.
However, I tried your original and it worked. At least I thought I did.
Then I looked more closely. What I actually tried was
if $sender_host_name matches "\\.(com|net)\\$"
Notice the subtle difference? That's the main problem!
--
Philip Hazel University Computing Service,
ph10@??? New Museums Site, Cambridge CB2 3QG,
P.Hazel@??? England. Phone: +44 1223 334714