Correct ES pattern & behaviour

Previously, the left-hand side was tested twice, causing different
incorrect behaviour when the terms were reversed. Now, both sides will
be tested equally.
Make $ a valid operator character

The dollar sign was intended to be an operator, but had been omitted
from the list of valid characters. This commit permits '$' to appear as
part of any operator name.