Class regexp.Result
All Packages Class Hierarchy This Package Previous Next Index
Class regexp.Result
java.lang.Object
|
+----regexp.Result
- public class Result
- extends Object
A Regexp result class. This is what's returned from a successful
Regexp match or search operation. This contains methods to return
the beginning and ending positions of the match, as well as the
actual text of the match. It is also possible get the beginning,
end and text of any of the submatches, as specified with the \(
and \) notations.
-
getMatch()
- Returns the text of the matched string.
-
getMatch(int)
- Returns the text of the nth parenthesized substring match in
the regular expression.
-
getMatchEnd()
- Returns the ending position of the matched string.
-
getMatchEnd(int)
- Returns the ending position of the nth parenthesized
substring match in the regular expression.
-
getMatchStart()
- Returns the starting position of the matched string.
-
getMatchStart(int)
- Returns the starting position of the nth parenthesized
substring match in the regular expression.
-
toString()
-
getMatchStart
public int getMatchStart(int n)
- Returns the starting position of the nth parenthesized
substring match in the regular expression. The 0th substring is
the entire match.
- Returns:
- the starting position of the nth substring
- Throws: NoSuchMatchException
- if n is out of range
getMatchEnd
public int getMatchEnd(int n)
- Returns the ending position of the nth parenthesized
substring match in the regular expression. The 0th substring is
the entire match.
- Returns:
- the end position of the nth substring
- Throws: NoSuchMatchException
- if n is out of range
getMatch
public String getMatch(int n)
- Returns the text of the nth parenthesized substring match in
the regular expression. The 0th substring is the entire match.
- Returns:
- the text of the nth substring
- Throws: NoSuchMatchException
- if n is out of range
getMatchStart
public int getMatchStart()
- Returns the starting position of the matched string.
- Returns:
- the starting position of the matched string
getMatchEnd
public int getMatchEnd()
- Returns the ending position of the matched string.
- Returns:
- the ending position of the matched string
getMatch
public String getMatch()
- Returns the text of the matched string.
- Returns:
- the text of the matched string
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index