Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string.
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string.
第一个value你操作了两次当然转义了2次,而后一个操作了一次当然就转义一次了
所以才像你所说的那个结果。
建议楼主看看jdk 有关这方面的东西在Package java.util.regex.pattern和java.util.regex.Matcher.replaceAll下