I met an old code that I wrote several years ago. However, now I have no idea why this works. I need to understand why it works before I proceed with the code changes.
I have CSV data
"abc",123456789,"def"
Sometimes the server returns me
"abc",123,456,789,"def"
So, I wrote the following code to solve it.
public class Sandbox { private static final Pattern digitPattern = Pattern.compile("(\",)|,(?=[\\d,]+,\")"); public static void main(String[] args) {
However, when I look back at the code, I have no idea why |, and [\\d,]+ can help me remove the comma. What part of the input |, matches?
A step-by-step explanation of how much analysis work is understood.
source share