I have written below regex
  "(?<customer>(\\w)+)" // to match c1 
        + "\\(((,)*" // To match (
        + "(?<product>(\\w)+),(?<likeness>(\\d)+)+)+" // to match p2,4
        + "\\)"; // To  match )
For below input:
C1(P2,51,P4,13)
Now Problem is when I execute
matcher.group("product");
It gives me p4, is there any way, I can get first p2 and then p4.