I am looking for a way to split a string after every 3rd comma. I have found an old answer from 2013 Split a String at every 3rd comma in Java which I think is outdated. If I copy paste the accepted answer as is I get a compile error saying
repetition not allowed inside lookbehind
I am using Intellij with Java 11, if that matters
Below the example from accepted answer from the linked post
String data = "0,0,1,2,4,5,3,4,6";
String[] array = data.split("(?<=\\G\\d+,\\d+,\\d+),");
for(String s : array){
System.out.println(s);
}
What is the proper way if the above is not correct anymore?