I'm looking to replace all occurrences of an escaped quote (\") with (\\\") in the string, then replacing all remaining unescaped quotes (") with escaped quotes (\"). Here's what I tried so far:
row = row.replaceAll("\\\\(?>\")", "\\\\\"");
row = row.replaceAll("((?<!\\\\)\")", "\"");
Example Input:
"This is a test with \" and "'s where \" is replaced with triple \'s before "
Example Output: \"This is a test with \\\" and \"'s where \\\" is replaced with triple \'s before \"
\\(?>\")"
works on https://www.freeformatter.com/java-regex-tester.html#ad-output in replaceAll doesn't find escaped quotes.
Any help on this is appreciated.