Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD


Class COM.stevesoft.pat.RegRes

java.lang.Object
  |
  +--COM.stevesoft.pat.RegRes
Subclasses:
Regex


public class RegRes
extends java.lang.Object
implements java.lang.Cloneable
This class is used to store a result from Regex



Field Summary
int charsMatched_
           
boolean didMatch_
           
int[] marks
           
int matchFrom_
           
int numSubs_
           
java.lang.String src
           
 
Constructor Summary
RegRes()
           
RegRes(RegRes r)
           

 
Method Summary
int charsMatched(int i)
          Obtains the number of characters matched by backreference i, or -1 if backreference i was not matched.
int charsMatched()
          After a successful match, this returns the number of characters in the match, or -1 if the match failed.
java.lang.Object clone()
           
boolean didMatch()
          Contains true if the last match was successful.
boolean equals(RegRes r)
           
java.lang.String getString()
          Obtain the text String that was matched against.
java.lang.String left()
          This returns the part of the string that preceeds the match, or null if the match failed.
java.lang.String left(int i)
          This returns the part of the string that follows the ith backreference, or null if the backreference did not match.
int matchedFrom(int i)
          Obtains the position backreference number i begins to match, or -1 if backreference i was not matched.
int matchedFrom()
          After a successful match, this returns the location of the first matching character, or -1 if the match failed.
int matchedTo(int i)
          This is either equal to matchedFrom(i)+charsMatched(i) if the match was successful, or -1 if it was not.
int matchedTo()
          This is matchedFrom()+charsMatched() after a successful match, or -1 otherwise.
int matchFrom()
          An older name for matchedFrom.
int matchFrom(int i)
          An older name for matchedFrom.
int numSubs()
          This returns the number of backreferences (parenthesis) in the pattern, i.e. the pattern "(ab)" has one, the pattern "(a)(b)" has two, etc.
java.lang.String right()
          This returns the part of the string that follows the match, or null if the backreference did not match.
java.lang.String right(int i)
          This returns the string to the right of the ith backreference, or null if the backreference did not match.
java.lang.String stringMatched()
          Obtains the match if successful, null otherwise.
java.lang.String stringMatched(int i)
          Obtains a substring matching the nth set of parenthesis from the pattern.
java.lang.String substring()
          An older name for stringMatched().
java.lang.String substring(int i)
          An older name for stringMatched.
java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

marks

protected int[] marks

didMatch_

protected boolean didMatch_

src

protected java.lang.String src

charsMatched_

protected int charsMatched_

matchFrom_

protected int matchFrom_

numSubs_

protected int numSubs_
Constructor Detail

RegRes

public RegRes()

RegRes

public RegRes(RegRes r)
Method Detail

getString

public java.lang.String getString()
Obtain the text String that was matched against.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(RegRes r)

stringMatched

public java.lang.String stringMatched()
Obtains the match if successful, null otherwise.

matchedFrom

public int matchedFrom(int i)
Obtains the position backreference number i begins to match, or -1 if backreference i was not matched.

charsMatched

public int charsMatched(int i)
Obtains the number of characters matched by backreference i, or -1 if backreference i was not matched.

matchedTo

public int matchedTo(int i)
This is either equal to matchedFrom(i)+charsMatched(i) if the match was successful, or -1 if it was not.

stringMatched

public java.lang.String stringMatched(int i)
Obtains a substring matching the nth set of parenthesis from the pattern. See numSubs(void), or null if the nth backrefence did not match.

left

public java.lang.String left()
This returns the part of the string that preceeds the match, or null if the match failed.

left

public java.lang.String left(int i)
This returns the part of the string that follows the ith backreference, or null if the backreference did not match.

right

public java.lang.String right()
This returns the part of the string that follows the match, or null if the backreference did not match.

right

public java.lang.String right(int i)
This returns the string to the right of the ith backreference, or null if the backreference did not match.

matchedFrom

public int matchedFrom()
After a successful match, this returns the location of the first matching character, or -1 if the match failed.

charsMatched

public int charsMatched()
After a successful match, this returns the number of characters in the match, or -1 if the match failed.

matchedTo

public int matchedTo()
This is matchedFrom()+charsMatched() after a successful match, or -1 otherwise.

numSubs

public int numSubs()
This returns the number of backreferences (parenthesis) in the pattern, i.e. the pattern "(ab)" has one, the pattern "(a)(b)" has two, etc.

didMatch

public boolean didMatch()
Contains true if the last match was successful.

matchFrom

public int matchFrom()
An older name for matchedFrom.

substring

public java.lang.String substring()
An older name for stringMatched().

matchFrom

public int matchFrom(int i)
An older name for matchedFrom.

substring

public java.lang.String substring(int i)
An older name for stringMatched.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD