Circumstances occasionally require rewriting that is sensitive to the location where a host name appears in an address. Host names can appear in several different contexts in an address:
In a source route
To the right of the at sign (@)
To the right of a percent sign (%) in the local-part
To the left of an exclamation point in the local-part
Under normal circumstances, a host name should be handled in the same way, regardless of where it appears. Some situations might require specialized handling.
Four control sequences are used to control matching on the basis of the host’s location in the address.
$S specifies that the rule can match a host extracted from a source route.
$A specifies that the rule can match a host found to the right of the @ sign.
$P specifies that the rule can match a host found to the right of a % sign.
$X specifies that the rule can match a host found to the left of an exclamation point (!).
The rule fails if the host is from a location other than the one specified. These sequences can be combined in a single rewrite rule. For example, if $S and $A are specified, the rule matches hosts specified in either a source route or to the right of the at sign. Specifying none of these sequences is equivalent to specifying all of them; the rule can match regardless of location.