$=
Match any token in a class LHS operator
When trying to match tokens in the workspace to
members of a class, you can use the $=
operator. For
example, consider the following rule:
R $+ < @ $={InternalHosts} > $: $1 < @ mailhub >
Here, the workspace is expected to hold a focused
address (such as
gw<@wash.dc.gov>). The
$={InternalHosts}
expression causes
sendmail to look up the host
part of the address (the
wash.dc.gov) in the class
{InternalHosts}
. If that host is found in
that class, a match is made and the workspace is
rewritten by the RHS to become
gw<@mailhub>.
Class macros in general are described in Chapter 22 on page 854, and the $=
operator in particular is described
in full in Matching Any in a Class: $=
on page 863.
Note that the $=
operator can be used only on the LHS of rules, and
that the $=
operator can be referenced by an RHS $
digit
operator.
Get sendmail, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.