toString for REGEXP_STRING should escape " (double quote)
garganti opened this issue · 0 comments
garganti commented
When calling toString for a RegExp that is a string, I would expect that a double quote gets escaped (if not already). This would allow to re-parse the same string to get the same RegExp. Here it is a failing test:
@test
public void problemRegExpToString() throws IOException {
String reg = "a\"";
System.out.println(reg); \ a"
RegExp regexR = new RegExp(reg);
System.out.println(regexR.toString()); \ "a""
new RegExp(regexR.toString()); // Exception
}
The second call for the constructor throws an exception (for the string is now "a""