Moderator

Because $ is a RegEx character. Parse it with \. i.e. \\$. You need two \'s because Java uses \ to parse characters as well so you need to parse the parse which ultimately results in \$ being sent to the RegEx compiler.

Speaking of RegEx, replace values in Strings with #replace(). The alternative #replaceAll() replaces uses RegEx matching which you do not need