This is not absolutely clear from documentation. Therefor I think one
should take '$' behaviour as undefined if characters are following.
As an example RexExp description from Emacs:
`$'
is similar to `^' but matches only at the end of a line. Thus,
`xx*$' matches a string of one or more `x''s at the end of a line.
This means, if you want to match a '$', you should escape it with a
preceding '\'.
-- Hardy Griech, Kurt-Schumacher-Str. 25/1, D-72762 Reutlingen