contains(CharSequence) is not a regex.

String value = s.contains("$") ? s.replaceAll("\\$", "") : s;


BTW: you don't need the ternary operator. If "\\$" isn't a matching pattern, the...