Allow regex replacement variables in HAO commands

The following variables are recognized in the command string
of an Hercules Automatic Operator rule:

$1 to $9 - the text which matched the 1st to 9th capturing
group in the target regular expression
$` - the text which precedes the regular expression match
$' - the text which follows the regular expression match
$$ - replaced by a single dollar sign

Substitution of a $n variable does not occur if there are
fewer than n capturing groups in the regular expression.