is there any efficient standard java library except String's split method that can help in counting the occurance of a given regex pattern in a given String object
Guys please throw some comments on below approach:
String s = "AA---AA---AA";
String[] temp = s.split("AA");
int count = temp.length - 1;