kiwi.text
Class PatternMatch

java.lang.Object
  |
  +--kiwi.text.PatternMatch

public class PatternMatch
extends Object

This class represents a pattern match. PatternMatch objects are returned by the PatternMatcher each time a sequence of characters in the input stream/string matches the compiled regular expression. Submatches (corresponding to portions of the regular expression that are in parentheses), and the entire matched string itself, may be retrieved from the PatternMatch object.

Version:
1.0 (05/98)
Author:
Mark Lindner, PING Software Group
See Also:
PatternMatcher

Method Summary
 String getMatch()
          Retrieve the matched string.
 String getSubmatch(int index)
          Retrieve a submatch from this match.
 int getSubmatchCount()
          Get the submatch count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMatch

public String getMatch()
Retrieve the matched string.

getSubmatch

public String getSubmatch(int index)
                   throws IllegalArgumentException
Retrieve a submatch from this match. Submatches are numbered beginning with 0 (zero), which corresponds to the whole matched string itself, and counting upward.
Parameters:
index - The index of the submatch to return.
Returns:
The submatch.
Throws:
IllegalArgumentException - If index is out of range.

getSubmatchCount

public int getSubmatchCount()
Get the submatch count. This returns the number of submatches for this match (not counting the matched string itself).
Returns:
The submatch count.