I am trying to split a string by comma, however I don't want to split if the comma is surrounded by quotes.
Here is what I am trying to do:
String s = "today,\"is, clear\",and sunny";
String[] split = s.split("(?>!\"[0-z]*),(?![0-z]*\")");
And the contents of split
would be ["today", "\"is, clear\"", "and sunny"]
, but I'm having trouble getting the regex to work right.