The $+ operator is very handy when you need to
match at least one token in the workspace. For example, recall that
the host part of an address containing zero tokens is bad, but one
containing one or more tokens is good:
george@ zero tokens is bad
george@wash one token is good
george@wash.dc.gov many tokens is good
A rule that seeks to match the host part of an address might look
like this:
R $- @ $+ $: $1 < @ $2 >
Here, the LHS matches any complete address—that is, an address
that contains a user part that is a single token (such as
george), an @ character, and
a host part that is one or more tokens (such as
wash or
wash.dc.gov). Any address
that matches is rewritten by the RHS to focus on the host part.
Focusing an address means to surround the host part in angle braces.
Thus, for example, george@wash will become
george<@wash>.
Note that the $+ operator can be used only on the
LHS of rules, and can be referenced by a
$digit operator on the
RHS.