| java.lang.Object org.apache.oro.text.regex.Perl5MatchResult
Perl5MatchResult | final class Perl5MatchResult implements MatchResult(Code) | | A class used to store and access the results of a Perl5Pattern match.
version: @version@ since: 1.0 See Also: PatternMatcher See Also: Perl5Matcher |
Field Summary | |
int[] | _beginGroupOffset_endGroupOffset Arrays containing the beginning and end offsets of the pattern
groups matched within the actual matched pattern contained in the
variable match .
Pattern matching methods that do not match subgroups, will only contain
entries for group 0, which always refers to the entire pattern.
beginGroupOffset contains the start offset of the groups,
indexed by group number, which will always be 0 for group 0.
endGroupOffset contains the ending offset + 1 of the groups.
A group matching the null string will have beginGroupOffset
and endGroupOffset entries of equal value. | String | _match The entire string that matched the pattern. | int | _matchBeginOffset The character offset into the line or stream where the match
begins. |
Constructor Summary | |
| Perl5MatchResult(int groups) Constructs a MatchResult able to store match information for
a number of subpattern groups.
Parameters: groups - The number of groups this MatchResult can store.Only postitive values greater than or equal to 1 make anysense. |
Method Summary | |
public int | begin(int group) Parameters: group - The pattern subgroup. | public int | beginOffset(int group) Returns an offset marking the beginning of the pattern match
relative to the beginning of the input.
Parameters: group - The pattern subgroup. | public int | end(int group) Parameters: group - The pattern subgroup. | public int | endOffset(int group) Returns an offset marking the end of the pattern match
relative to the beginning of the input.
Parameters: group - The pattern subgroup. | public String | group(int group) Parameters: group - The pattern subgroup to return. | public int | groups() The number of groups contained in the result. | public int | length() | public String | toString() The same as group(0). |
_beginGroupOffset_endGroupOffset | int[] _beginGroupOffset_endGroupOffset(Code) | | Arrays containing the beginning and end offsets of the pattern
groups matched within the actual matched pattern contained in the
variable match .
Pattern matching methods that do not match subgroups, will only contain
entries for group 0, which always refers to the entire pattern.
beginGroupOffset contains the start offset of the groups,
indexed by group number, which will always be 0 for group 0.
endGroupOffset contains the ending offset + 1 of the groups.
A group matching the null string will have beginGroupOffset
and endGroupOffset entries of equal value. Following a
convention established by the GNU regular expression library for the
C language, groups that are not part of a match contain -1 as their
begin and end offsets.
|
_match | String _match(Code) | | The entire string that matched the pattern.
|
_matchBeginOffset | int _matchBeginOffset(Code) | | The character offset into the line or stream where the match
begins. Pattern matching methods that look for matches a line at
a time should use this field as the offset into the line
of the match. Methods that look for matches independent of line
boundaries should use this field as the offset into the entire
text stream.
|
Perl5MatchResult | Perl5MatchResult(int groups)(Code) | | Constructs a MatchResult able to store match information for
a number of subpattern groups.
Parameters: groups - The number of groups this MatchResult can store.Only postitive values greater than or equal to 1 make anysense. At minimum, a MatchResult stores one group whichrepresents the entire pattern matched including all subparts. |
begin | public int begin(int group)(Code) | | Parameters: group - The pattern subgroup. The offset into group 0 of the first token in the indicatedpattern subgroup. If a group was never matched or doesnot exist, returns -1. |
beginOffset | public int beginOffset(int group)(Code) | | Returns an offset marking the beginning of the pattern match
relative to the beginning of the input.
Parameters: group - The pattern subgroup. The offset of the first token in the indicatedpattern subgroup. If a group was never matched or doesnot exist, returns -1. |
end | public int end(int group)(Code) | | Parameters: group - The pattern subgroup. Returns one plus the offset into group 0 of the last token inthe indicated pattern subgroup. If a group was never matchedor does not exist, returns -1. A group matching the nullstring will return its start offset. |
endOffset | public int endOffset(int group)(Code) | | Returns an offset marking the end of the pattern match
relative to the beginning of the input.
Parameters: group - The pattern subgroup. Returns one plus the offset of the last token inthe indicated pattern subgroup. If a group was never matchedor does not exist, returns -1. A group matching the nullstring will return its start offset. |
group | public String group(int group)(Code) | | Parameters: group - The pattern subgroup to return. A string containing the indicated pattern subgroup. Group0 always refers to the entire match. If a group was nevermatched, it returns null. This is not to be confused witha group matching the null string, which will return a Stringof length 0. |
groups | public int groups()(Code) | | The number of groups contained in the result. This numberincludes the 0th group. In other words, the result refersto the number of parenthesized subgroups plus the entire matchitself. |
length | public int length()(Code) | | The length of the match. |
toString | public String toString()(Code) | | The same as group(0).
A string containing the entire match. |
|
|