|
|||||||||
| Home >> All >> com >> memoire >> [ re overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.memoire.re
Class REMatch

java.lang.Objectcom.memoire.re.REMatch
- public class REMatch
- extends java.lang.Object
An instance of this class represents a match completed by a gnu.regexp matching function. It can be used to obtain relevant information about the location of a match or submatch.
| Field Summary | |
(package private) int |
anchor
|
(package private) int[] |
count
|
(package private) int[] |
end
|
private java.lang.String |
m_match
|
(package private) int |
offset
|
(package private) int[] |
start
|
| Constructor Summary | |
(package private) |
REMatch(int f_subs,
int f_index)
|
| Method Summary | |
(package private) void |
clear(int f_index)
|
(package private) void |
finish(RECharIndexed text)
|
int |
getEndIndex()
Returns the index within the input string where the match in its entirety ends. |
int |
getStartIndex()
Returns the index within the input text where the match in its entirety began. |
int |
getSubEndIndex(int sub)
Returns the index within the input string used to generate this match where subexpression number sub ends, or -1 if
the subexpression does not exist. |
int |
getSubStartIndex(int sub)
Returns the index within the input string used to generate this match where subexpression number sub begins, or -1 if
the subexpression does not exist. |
(package private) void |
reset(int f_subIndex)
|
java.lang.String |
substituteInto(java.lang.String input)
Substitute the results of this match to create a new string. |
java.lang.String |
toString()
Returns the string matching the pattern. |
java.lang.String |
toString(int sub)
Returns the string matching the given subexpression. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
m_match
private java.lang.String m_match
offset
int offset
anchor
int anchor
start
int[] start
end
int[] end
count
int[] count
| Constructor Detail |
REMatch
REMatch(int f_subs,
int f_index)
| Method Detail |
finish
void finish(RECharIndexed text)
reset
void reset(int f_subIndex)
clear
void clear(int f_index)
toString
public java.lang.String toString()
- Returns the string matching the pattern. This makes it convenient
to write code like the following:
REMatch myMatch = myExpression.getMatch(myString);
if (myMatch != null) System.out.println("Regexp found: "+myMatch);
getStartIndex
public int getStartIndex()
- Returns the index within the input text where the match in its entirety
began.
getEndIndex
public int getEndIndex()
- Returns the index within the input string where the match in its entirety
ends. The return value is the next position after the end of the string;
therefore, a match created by the following call:
REMatch myMatch = myExpression.getMatch(myString);can be viewed (given that myMatch is not null) by creating
String theMatch = myString.substring(myMatch.getStartIndex(), myMatch.getEndIndex());But you can save yourself that work, since the
toString()method (above) does exactly that for you.
toString
public java.lang.String toString(int sub)
- Returns the string matching the given subexpression.
getSubStartIndex
public int getSubStartIndex(int sub)
- Returns the index within the input string used to generate this match
where subexpression number sub begins, or
-1if the subexpression does not exist.
getSubEndIndex
public int getSubEndIndex(int sub)
- Returns the index within the input string used to generate this match
where subexpression number sub ends, or
-1if the subexpression does not exist.
substituteInto
public java.lang.String substituteInto(java.lang.String input)
- Substitute the results of this match to create a new string.
This is patterned after PERL, so the tokens to watch out for are
$0through$9.$0matches the full substring matched;$nmatches subexpression number n.
|
|||||||||
| Home >> All >> com >> memoire >> [ re overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.memoire.re.REMatch