com.raelity.text
Class RegExpResult

java.lang.Object
  extended by com.raelity.text.RegExpResult
Direct Known Subclasses:
RegExpResultJava

public abstract class RegExpResult
extends Object

This class hold the results of a regular expression pattern against an input. It is useful for saving the result of RegExp.search before performing another search. These same methods are available in RegExp.

This class is not a superclass of RegExp, even though all the methods of this class appear in and have identical function to methods in RegExp, because there could be negative implications on performance depending on the regular expression implementation.


Constructor Summary
RegExpResult()
           
 
Method Summary
abstract  String group(int i)
          Retrive backreference (matching string in the input) for the ith set of parenthesis in the pattern.
abstract  boolean isMatch()
          Check if the associated search produced a match.
abstract  int length(int i)
          The length of the of corresponding backreference.
abstract  int nGroup()
          Return the number of backreferences.
abstract  int start(int i)
          The returned value is the offset from the beginning of the input to where the ith backreference starts.
abstract  int stop(int i)
          The returned value is the offset from the beginning of the input to where the ith backreference ends.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExpResult

public RegExpResult()
Method Detail

isMatch

public abstract boolean isMatch()
Check if the associated search produced a match.

Returns:
True if the input matched. Otherwise false.

nGroup

public abstract int nGroup()
Return the number of backreferences.


group

public abstract String group(int i)
Retrive backreference (matching string in the input) for the ith set of parenthesis in the pattern. The backreference groups are numbered starting with 1. If i == 0 then return the part of the input string that matched the pattern.

Returns:
The specified backreference or null if backreference did not match.

length

public abstract int length(int i)
The length of the of corresponding backreference. If i == 0 then the length of the entire match is returned.

Returns:
The length of the specified backreference.

start

public abstract int start(int i)
The returned value is the offset from the beginning of the input to where the ith backreference starts. If i == 0 then the value is the offset in the input where entire match starts.


stop

public abstract int stop(int i)
The returned value is the offset from the beginning of the input to where the ith backreference ends. If i == 0 then the value is the offset in the input where entire match ends.