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.
31 *java.util.regex.MatchResult.end()*
35 Returns the offset after the last character matched.
38 Returns: @return The offset after the last character matched
39 *java.util.regex.MatchResult.end(int)*
41 public int end(int group)
43 Returns the offset after the last character of the subsequence captured by the
44 given group during this match.
46 Capturing groups are indexed from left to right, starting at one. Group zero
47 denotes the entire pattern, so the expression m.end(0) is equivalent to
50 group - The index of a capturing group in this matcher's pattern
52 Returns: The offset after the last character captured by the group, or -1 if the match
53 was successful but the group itself did not match anything
54 *java.util.regex.MatchResult.group()*
56 public |java.lang.String| group()
58 Returns the input subsequence matched by the previous match.
60 For a matcher m with input sequence s, the expressions m.group() and
61 s.substring(m.start(),m.end()) are equivalent.
63 Note that some patterns, for example a*, match the empty string. This method
64 will return the empty string when the pattern successfully matches the empty
68 Returns: The (possibly empty) subsequence matched by the previous match, in string form
69 *java.util.regex.MatchResult.group(int)*
71 public |java.lang.String| group(int group)
73 Returns the input subsequence captured by the given group during the previous
76 For a matcher m, input sequence s, and group index g, the expressions
77 m.group(g) and s.substring(m.start(g),m.end(g)) are equivalent.
79 Capturing groups are indexed from left to right, starting at one. Group zero
80 denotes the entire pattern, so the expression m.group(0) is equivalent to
83 If the match was successful but the group specified failed to match any part of
84 the input sequence, then null is returned. Note that some groups, for example
85 (a*), match the empty string. This method will return the empty string when
86 such a group successfully matches the empty string in the input.
88 group - The index of a capturing group in this matcher's pattern
90 Returns: The (possibly empty) subsequence captured by the group during the previous
91 match, or null if the group failed to match part of the input
92 *java.util.regex.MatchResult.groupCount()*
94 public int groupCount()
96 Returns the number of capturing groups in this match result's pattern.
98 Group zero denotes the entire pattern by convention. It is not included in this
101 Any non-negative integer smaller than or equal to the value returned by this
102 method is guaranteed to be a valid group index for this matcher.
105 Returns: The number of capturing groups in this matcher's pattern
106 *java.util.regex.MatchResult.start()*
110 Returns the start index of the match.
113 Returns: The index of the first character matched
114 *java.util.regex.MatchResult.start(int)*
116 public int start(int group)
118 Returns the start index of the subsequence captured by the given group during
121 Capturing groups are indexed from left to right, starting at one. Group zero
122 denotes the entire pattern, so the expression m.start(0) is equivalent to
125 group - The index of a capturing group in this matcher's pattern
127 Returns: The index of the first character captured by the group, or -1 if the match was
128 successful but the group itself did not match anything