On Tue, 6 Sep 2022 17:53:32 GMT, Weijun Wang <wei...@openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/provider/PolicyParser.java line 
>> 1180:
>> 
>>> 1178:                 // and then in a java string, it's escaped again
>>> 1179: 
>>> 1180:                 out.print(name.replaceAll("\\\\", 
>>> "\\\\\\\\").replaceAll("\"", "\\\\\\\""));
>> 
>> Why does IJ say this is the same? This appears to replace backslash-quote 
>> with quote.
>
> My understanding: In regex, there is no need to escape `"`, so `"` is the 
> same as `"`.

Ok,but the regex is `"\\""`, so shouldn't it keep the double-backslash at the 
beginning (`\`)?, i.e.:

`...replaceAll("\"", "\\\\\\""));`

-------------

PR: https://git.openjdk.org/jdk/pull/9972

Reply via email to