Matcher.groupCount() Example
From Java Example Source Code
Contents |
[edit] Overview - Matcher.groupCount() Example
This Java example program demonstrates the usage of the Matcher.groupCount() method.
[edit] Java Source Code
- Package: example.matcher
- File: MatcherGroupCountExample.java
package example.matcher; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MatcherGroupCountExample { public static void main(String args[]) { Pattern p = Pattern.compile("B(ond)"); String candidateString = "My name is Bond. James Bond."; Matcher matcher = p.matcher(candidateString); int numberOfGroups = matcher.groupCount(); System.out.println("numberOfGroups =" + numberOfGroups); } }
[edit] What Result You Can Get
Run the program, you will get:
numberOfGroups =1
[edit] Required External Libraries and/or Files for this Java Example
Need nothing.
http://www.ase2009.com/ online casino 132 http://www.hellzyea.com/health health insurance 8DDD http://www.yourautoinsurancesite.com/ auto insurance quotes 135811 http://www.makemeasammich.com/ auto insurance mcnxu
[edit] Question & Answer
Any question?
Click edit and post your question or answer here.
