I'm running the next code:
Pattern p = Pattern.compile("(<http:.*>)");
Matcher m = p.matcher("<http:[email protected]>,<http:[email protected]>");
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:[email protected],http:[email protected]" But I expect that there should be two groups : Group_1: http:[email protected] Group_2: http:[email protected]
How should I change my regex to achieve this?
Thanks!