Dollar has no special meaning in a character class. The meaning of dollar can be changed so that it matches only at the very end of the string, by setting the dollar_endonly option at compile time. This does not affect the \Z assertion. The meanings of the circumflex and dollar ...