- group
- the group, ranging from 0 to groupCount() - 1, with 0 representing the whole pattern.
Documentation for this section has not yet been entered.
Type Reason Java.Lang.IllegalStateException if no successful match has been made.
Returns the text that matched a given group of the regular expression.
Explicit capturing groups in the pattern are numbered left to right in order of their opening parenthesis, starting at 1. The special group 0 represents the entire match (as if the entire pattern is surrounded by an implicit capturing group). For example, "a((b)c)" matching "abc" would give the following groups:
java Example
0 "abc" 1 "bc" 2 "b"
An optional capturing group that failed to match as part of an overall successful match (for example, "a(b)?c" matching "ac") returns null. A capturing group that matched the empty string (for example, "a(b?)c" matching "ac") returns the empty string.