ADDITIONAL SYSTEM INFORMATION :
OS: Windows 10 Pro
java: Java SE Development Kit 8u211 for Windows x64
A DESCRIPTION OF THE PROBLEM :
The replaceAll method of a String object produces unexpected results.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
String sourceText = "ab";
String regex = "ab";
String replacement = "\\\"";
String result = sourceText.replaceAll(regex, replacement);
if (!result.equals(replacement)) {
throw new RuntimeException("Replacement result does not meet expectations");
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The variable 'result' is equal to the variable 'replacement'
ACTUAL -
The variable 'result' is not equal to the variable 'replacement'
FREQUENCY : always
OS: Windows 10 Pro
java: Java SE Development Kit 8u211 for Windows x64
A DESCRIPTION OF THE PROBLEM :
The replaceAll method of a String object produces unexpected results.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
String sourceText = "ab";
String regex = "ab";
String replacement = "\\\"";
String result = sourceText.replaceAll(regex, replacement);
if (!result.equals(replacement)) {
throw new RuntimeException("Replacement result does not meet expectations");
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The variable 'result' is equal to the variable 'replacement'
ACTUAL -
The variable 'result' is not equal to the variable 'replacement'
FREQUENCY : always