I'm running the next code:
Pattern p = Pattern.compile("(<http:.*>)");
Matcher m = p.matcher("<http:fluffy1@cisco.com>,<http:fluffy2@cisco.com>");
if (m.find()) {
int groupCount = m.groupCount();
for(int i = 0; i < groupCount; i++){
String groupValue = m.group(i);
System.out.println(groupValue);
}
} else {
System.out.println("nothing was fined");
}
And as output I have only one group value: "http:fluffy1@cisco.com,http:fluffy2@cisco.com" But I expect that there should be two groups : Group_1: http:fluffy1@cisco.com Group_2: http:fluffy2@cisco.com
How should I change my regex to achieve this?
Thanks!