Circumstances occasionally require rewriting that's 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, or 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. Situations can arise, however, which may necessitate 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 may match a host extracted from a source route, $A specifies that the rule may match a host found to the right of the at sign, $P specifies that the rule may match a host found to the right of a percent sign, and $X specifies that the rule may match a host found to the left of an exclamation point. The rule will fail if the host is from a location other than one specified.
These sequences can be combined in a single rewrite rule. For example, if $S and $A are specified the rule will match 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.