1 *java.util.regex.MatchResult* *MatchResult* The result of a match operation.
3 public interface interface MatchResult
6 |java.util.regex.MatchResult_Description|
7 |java.util.regex.MatchResult_Fields|
8 |java.util.regex.MatchResult_Constructors|
9 |java.util.regex.MatchResult_Methods|
11 ================================================================================
13 *java.util.regex.MatchResult_Methods*
14 |java.util.regex.MatchResult.end()|Returns the offset after the last character
15 |java.util.regex.MatchResult.end(int)|Returns the offset after the last charact
16 |java.util.regex.MatchResult.group()|Returns the input subsequence matched by t
17 |java.util.regex.MatchResult.group(int)|Returns the input subsequence captured
18 |java.util.regex.MatchResult.groupCount()|Returns the number of capturing group
19 |java.util.regex.MatchResult.start()|Returns the start index of the match.
20 |java.util.regex.MatchResult.start(int)|Returns the start index of the subseque
22 *java.util.regex.MatchResult_Description*
24 The result of a match operation.
26 This interface contains query methods used to determine the results of a match
27 against a regular expression. The match boundaries, groups and group boundaries
28 can be seen but not modified through a MatchResult.
32 *java.util.regex.MatchResult.end()*
36 Returns the offset after the last character matched.
40 Returns: @return The offset after the last character matched
42 *java.util.regex.MatchResult.end(int)*
44 public int end(int group)
46 Returns the offset after the last character of the subsequence captured by the
47 given group during this match.
49 Capturing groups are indexed from left to right, starting at one. Group zero
50 denotes the entire pattern, so the expression m.end(0) is equivalent to
54 group - The index of a capturing group in this matcher's pattern
56 Returns: The offset after the last character captured by the group, or -1 if the match
57 was successful but the group itself did not match anything
59 *java.util.regex.MatchResult.group()*
61 public |java.lang.String| group()
63 Returns the input subsequence matched by the previous match.
65 For a matcher m with input sequence s, the expressions m.group() and
66 s.substring(m.start(),m.end()) are equivalent.
68 Note that some patterns, for example a*, match the empty string. This method
69 will return the empty string when the pattern successfully matches the empty
74 Returns: The (possibly empty) subsequence matched by the previous match, in string form
76 *java.util.regex.MatchResult.group(int)*
78 public |java.lang.String| group(int group)
80 Returns the input subsequence captured by the given group during the previous
83 For a matcher m, input sequence s, and group index g, the expressions
84 m.group(g) and s.substring(m.start(g),m.end(g)) are equivalent.
86 Capturing groups are indexed from left to right, starting at one. Group zero
87 denotes the entire pattern, so the expression m.group(0) is equivalent to
90 If the match was successful but the group specified failed to match any part of
91 the input sequence, then null is returned. Note that some groups, for example
92 (a*), match the empty string. This method will return the empty string when
93 such a group successfully matches the empty string in the input.
96 group - The index of a capturing group in this matcher's pattern
98 Returns: The (possibly empty) subsequence captured by the group during the previous
99 match, or null if the group failed to match part of the input
101 *java.util.regex.MatchResult.groupCount()*
103 public int groupCount()
105 Returns the number of capturing groups in this match result's pattern.
107 Group zero denotes the entire pattern by convention. It is not included in this
110 Any non-negative integer smaller than or equal to the value returned by this
111 method is guaranteed to be a valid group index for this matcher.
115 Returns: The number of capturing groups in this matcher's pattern
117 *java.util.regex.MatchResult.start()*
121 Returns the start index of the match.
125 Returns: The index of the first character matched
127 *java.util.regex.MatchResult.start(int)*
129 public int start(int group)
131 Returns the start index of the subsequence captured by the given group during
134 Capturing groups are indexed from left to right, starting at one. Group zero
135 denotes the entire pattern, so the expression m.start(0) is equivalent to
139 group - The index of a capturing group in this matcher's pattern
141 Returns: The index of the first character captured by the group, or -1 if the match was
142 successful but the group itself did not match anything