I have this program
Pattern p = Pattern.compile("<id>(.*?)</id><fn>(.*?)</fn><fl>(.*?)</fl>");
String candidateString = "<file><id>4</id><fn>abcd</fn><fl>c:</fl></file>";
Matcher matcher = p.matcher(candidateString);
int numberOfGroups = matcher.groupCount();
System.out.println("numberOfGroups =" + numberOfGroups);
I am expecting numberOfGroups should be 1 but it gave me 3 why? and how will get count 1 ? any help?