My Java webservice's input is a comma separated list of strings ("ABC1,ABCD2,A1,A234B456,C1").
If my split threshold is 2 then I need to split it as
ABC1,ABCD2
A1,A234B456
C1
If my split threshold is 3 then I need to split it as
ABC1,ABCD2,A1
A234B456,C1
I'm trying to figure out a Java regex way of doing this. I tried checking out StringUtils API but no luck.