VOOZH about

URL: https://www.geeksforgeeks.org/java/matcher-groupcount-method-in-java-with-examples/

⇱ Matcher groupCount() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Matcher groupCount() method in Java with Examples

Last Updated : 26 Nov, 2018
The groupCount() method of Matcher Class is used to get the number of capturing groups in this matcher's pattern. Syntax:
public int groupCount()
Parameters: This method do not takes any parameter. Return Value: This method returns the number of capturing groups in this matcher's pattern. Below examples illustrate the Matcher.groupCount() method: Example 1:
Output:
0
Example 2:
Output:
0
Reference: Oracle Doc
Comment