This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
This code will extract all the characters as a group, but the commas are still there. You could use the String.split() method the extract the comma delimited Strings. The regex I came up with presupposes that there will always be at least one comma in the values, no commas outside of the values, but as many values as you want. If these assumptions don't match the actual problem, you'll have to adjust the regex accordingly. i.e. it will match: a,b,c a,b,c,d,e,f a, abc,def,ghi
but not: a abc
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Joined: Oct 27, 2004
Thanks for your reply.
Finally, I'd updated the pattern to the following to extract the (). And then I put the result into the matcher agin to get the result.