I want to know why this regex group is not working for me in JAVA? It's throwing exception while finding match of group. I am trying to match the numbers separated by dashes.
Pattern p = Pattern.compile("([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)");
Matcher matcher = p.matcher("1-1-3-1-4");
matcher.group(0); // Exception happens here - java.lang.IllegalStateException: No match found