The second parameter of replaceAll() is the replacement string. And with a replacement string, the $ has special meaning. It is expected to be followed by a number, that represents the group that was captured, when the regex (first parameter) was used to find the substring to replace. In your case, the $ is not followed by a number.
But the $ is preceded by a backslash to escape it...(at least it is in the example he gave)
(*lightbulb*) or it's MEANT to be.
In the original post, Steve posted it with TWO backslashes. Which is exactly the value you would want to represent it as a STRING, but not the value you want stored in the configuration.
i.e. one backslash is required to escape the $ in the regex replacement value : \$
If you put this replacement value into a String, you need to escape your backslash: hence "\\$"
To demonstrate:
Which results in:
//sgai-fs02/qmsattachments\$/QMSAttachments/
//sgai-fs02/qmsattachments$/QMSAttachments/ //sgai-fs02/qmsattachments$/QMSAttachments/
Note how the "newValue" printed only includes one backslash?
@Steve: Remove one of those backslash characters before your $ in the configuration value and it should be good.
The extra backslash is only needed if the string is represented as a string literal -- for the compiler to parse. For the actual string object itself (or if you try to print it), there is no extra backslash.
Anyway, if you need to remove all the special meaning off of a replacement string, then I recommend that you use the Matcher.quoteReplacement() method.