For an input string like:
10,14,"1011 testing 1",10,"1022 testing 2",10,"1033, 234, testing 3"
where those double quote characters are a part of the string, I need to set a pattern that recognizes the numbers and commas following them, but not when they're inside the quotes.
I'm using it in groovy code, so I'm doing a replaceAll call where the regex max means I am going to replace it with an empty string ("").
That input string needs to become:
"1011 testing 1","1022 testing 2","1033, 234, testing 3"
This:
[0-9]+,
gets me to recognize the numbers followed by commas. But how do I say that last part about not when inside double quotes? Is there a way to say as long as there are an even number of double quotes before the match?
I see other posts that are somewhat similar, but they're not quite the same.
s.findAll(/"[^"]*"/).join(",")? - Wiktor Stribiżew