|
|||||||||
| Home >> All >> gnu >> [ regexp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
gnu.regexp
Class RE

java.lang.Objectgnu.regexp.REToken
gnu.regexp.RE
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Serializable
- Direct Known Subclasses:
- UncheckedRE
- public class RE
- extends REToken
RE provides the user interface for compiling and matching regular expressions.
A regular expression object (class RE) is compiled by constructing it
from a String, StringBuffer or character array, with optional
compilation flags (below)
and an optional syntax specification (see RESyntax; if not specified,
RESyntax.RE_SYNTAX_PERL5 is used).
Once compiled, a regular expression object is reusable as well as threadsafe: multiple threads can use the RE instance simultaneously to match against different input text.
Various methods attempt to match input text against a compiled regular expression. These methods are:
isMatch: returns true if the input text in its
entirety matches the regular expression pattern.
getMatch: returns the first match found in the
input text, or null if no match is found.
getAllMatches: returns an array of all
non-overlapping matches found in the input text. If no matches are
found, the array is zero-length.
substitute: substitute the first occurence of the
pattern in the input text with a replacement string (which may
include metacharacters $0-$9, see REMatch.substituteInto).
substituteAll: same as above, but repeat for each
match before returning.
getMatchEnumeration: returns an REMatchEnumeration
object that allows iteration over the matches (see
REMatchEnumeration for some reasons why you may want to do this
instead of using getAllMatches.
These methods all have similar argument lists. The input can be a
CharIndexed, String, a character array, a StringBuffer, or an
InputStream of some sort. Note that when using an
InputStream, the stream read position cannot be guaranteed after
attempting a match (this is not a bug, but a consequence of the way
regular expressions work). Using an REMatchEnumeration can
eliminate most positioning problems.
Although the input object can be of various types, it is recommended
that it should be a CharIndexed because CharIndexed.getLastMatch() 55
can show the last match found on this input, which helps the expression
\G work as the end of the previous match.
The optional index argument specifies the offset from the beginning of the text at which the search should start (see the descriptions of some of the execution flags for how this can affect positional pattern operators). For an InputStream, this means an offset from the current read position, so subsequent calls with the same index argument on an InputStream will not necessarily access the same position on the stream, whereas repeated searches at a given index in a fixed string will return consistent results.
You can optionally affect the execution environment by using a combination of execution flags (constants listed below).
All operations on a regular expression are performed in a thread-safe manner.
- Version:
- 1.1.5-dev, to be released
| Nested Class Summary | |
private static class |
RE.CharExpression
This class represents various expressions for a character. |
private static class |
RE.CharUnit
|
private static class |
RE.IntPair
|
private static class |
RE.NamedProperty
This class represents a substring in a pattern string expressing a named property. |
private static class |
RE.ParseCharClassResult
|
| Field Summary | |
private REToken |
firstToken
|
private REToken |
lastToken
|
private int |
maximumLength
|
private static java.util.ResourceBundle |
messages
|
private int |
minimumLength
Minimum length, in characters, of any possible match. |
protected REToken |
next
|
private int |
numSubs
|
static int |
REG_ANCHORINDEX
Execution flag. |
static int |
REG_DOT_NEWLINE
Compilation flag. |
static int |
REG_ICASE
Compilation flag. |
static int |
REG_ICASE_USASCII
Compilation flag. |
static int |
REG_MULTILINE
Compilation flag. |
static int |
REG_NO_INTERPOLATE
Execution flag. |
static int |
REG_NOTBOL
Execution flag. |
static int |
REG_NOTEOL
Execution flag. |
static int |
REG_REPLACE_USE_BACKSLASHESCAPE
Execution flag. |
static int |
REG_TRY_ENTIRE_MATCH
Execution flag. |
static int |
REG_X_COMMENTS
Compilation flag. |
protected int |
subIndex
|
protected REToken |
uncle
|
protected boolean |
unicodeAware
|
private static java.lang.String |
VERSION
|
| Constructor Summary | |
protected |
RE()
|
|
RE(java.lang.Object pattern)
Constructs a regular expression pattern buffer without any compilation flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5). |
|
RE(java.lang.Object pattern,
int cflags)
Constructs a regular expression pattern buffer using the specified compilation flags and the default syntax (RESyntax.RE_SYNTAX_PERL5). |
|
RE(java.lang.Object pattern,
int cflags,
RESyntax syntax)
Constructs a regular expression pattern buffer using the specified compilation flags and regular expression syntax. |
private |
RE(java.lang.Object patternObj,
int cflags,
RESyntax syntax,
int myIndex,
int nextSub)
|
private |
RE(REToken first,
REToken last,
int subs,
int subIndex,
int minLength,
int maxLength)
|
| Method Summary | |
private void |
addToken(REToken next)
|
(package private) REMatch |
backtrack(CharIndexed input,
REMatch mymatch,
java.lang.Object param)
Backtrack to another possibility. |
(package private) boolean |
chain(REToken next)
|
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
(package private) void |
dump(java.lang.StringBuffer os)
|
(package private) void |
dumpAll(java.lang.StringBuffer os)
|
(package private) int |
findFixedLengthMatches(CharIndexed input,
REMatch mymatch,
int max)
|
(package private) REMatch |
findMatch(CharIndexed input,
REMatch mymatch)
Finds a match at the position specified by the given REMatch. |
REMatch[] |
getAllMatches(java.lang.Object input)
Returns an array of all matches found in the input. |
REMatch[] |
getAllMatches(java.lang.Object input,
int index)
Returns an array of all matches found in the input, beginning at the specified index position. |
REMatch[] |
getAllMatches(java.lang.Object input,
int index,
int eflags)
Returns an array of all matches found in the input string, beginning at the specified index position and using the specified execution flags. |
private REMatch[] |
getAllMatchesImpl(CharIndexed input,
int index,
int eflags)
|
private static RE.CharExpression |
getCharExpression(char[] input,
int pos,
int lim,
RESyntax syntax)
|
private static int |
getCharUnit(char[] input,
int index,
RE.CharUnit unit,
boolean quot)
|
(package private) static java.lang.String |
getLocalizedMessage(java.lang.String key)
|
REMatch |
getMatch(java.lang.Object input)
Returns the first match found in the input. |
REMatch |
getMatch(java.lang.Object input,
int index)
Returns the first match found in the input, beginning the search at the specified index. |
REMatch |
getMatch(java.lang.Object input,
int index,
int eflags)
Returns the first match found in the input, beginning the search at the specified index, and using the specified execution flags. |
REMatch |
getMatch(java.lang.Object input,
int index,
int eflags,
java.lang.StringBuffer buffer)
Returns the first match found in the input, beginning the search at the specified index, and using the specified execution flags. |
REMatchEnumeration |
getMatchEnumeration(java.lang.Object input)
Returns an REMatchEnumeration that can be used to iterate over the matches found in the input text. |
REMatchEnumeration |
getMatchEnumeration(java.lang.Object input,
int index)
Returns an REMatchEnumeration that can be used to iterate over the matches found in the input text. |
REMatchEnumeration |
getMatchEnumeration(java.lang.Object input,
int index,
int eflags)
Returns an REMatchEnumeration that can be used to iterate over the matches found in the input text. |
(package private) REMatch |
getMatchImpl(CharIndexed input,
int anchor,
int eflags,
java.lang.StringBuffer buffer)
|
int |
getMaximumLength()
|
int |
getMinimumLength()
Returns the minimum number of characters that could possibly constitute a match of this regular expression. |
private int |
getMinMax(char[] input,
int index,
RE.IntPair minMax,
RESyntax syntax)
|
private static RE.NamedProperty |
getNamedProperty(char[] input,
int pos,
int lim)
|
(package private) REToken |
getNext()
Returns the next REToken chained to this REToken. |
int |
getNumSubs()
Returns the maximum number of subexpressions in this regular expression. |
private static int |
getPosixSet(char[] pattern,
int index,
java.lang.StringBuffer buf)
|
static java.lang.String |
getReplacement(java.lang.String replace,
REMatch m,
int eflags)
|
private static RETokenNamedProperty |
getRETokenNamedProperty(int subIndex,
RE.NamedProperty np,
boolean insens,
int index)
|
protected void |
initialize(java.lang.Object patternObj,
int cflags,
RESyntax syntax,
int myIndex,
int nextSub)
|
boolean |
isMatch(java.lang.Object input)
Checks if the regular expression matches the input in its entirety. |
boolean |
isMatch(java.lang.Object input,
int index)
Checks if the input string, starting from index, is an exact match of this regular expression. |
boolean |
isMatch(java.lang.Object input,
int index,
int eflags)
Checks if the input, starting from index and using the specified execution flags, is an exact match of this regular expression. |
private boolean |
isMatchImpl(CharIndexed input,
int index,
int eflags)
|
static CharIndexed |
makeCharIndexed(java.lang.Object input,
int index)
|
(package private) boolean |
match(CharIndexed input,
REMatch mymatch)
Returns true if the match succeeded, false if it failed. |
(package private) REMatch |
matchThis(CharIndexed input,
REMatch mymatch)
Returns true if the match succeeded, false if it failed. |
protected boolean |
next(CharIndexed input,
REMatch mymatch)
Returns true if the rest of the tokens match, false if they fail. |
private static RE.ParseCharClassResult |
parseCharClass(int subIndex,
char[] pattern,
int index,
int pLength,
int cflags,
RESyntax syntax,
int pflags)
Parse [...] or [^...] and make an RETokenOneOf instance. |
private static int |
parseInt(char[] input,
int pos,
int len,
int radix)
|
(package private) boolean |
returnsFixedLengthMatches()
|
private static REToken |
setRepeated(REToken current,
int min,
int max,
int index)
|
(package private) void |
setUncle(REToken uncle)
|
java.lang.String |
substitute(java.lang.Object input,
java.lang.String replace)
Substitutes the replacement text for the first match found in the input. |
java.lang.String |
substitute(java.lang.Object input,
java.lang.String replace,
int index)
Substitutes the replacement text for the first match found in the input beginning at the specified index position. |
java.lang.String |
substitute(java.lang.Object input,
java.lang.String replace,
int index,
int eflags)
Substitutes the replacement text for the first match found in the input string, beginning at the specified index position and using the specified execution flags. |
java.lang.String |
substituteAll(java.lang.Object input,
java.lang.String replace)
Substitutes the replacement text for each non-overlapping match found in the input text. |
java.lang.String |
substituteAll(java.lang.Object input,
java.lang.String replace,
int index)
Substitutes the replacement text for each non-overlapping match found in the input text, starting at the specified index. |
java.lang.String |
substituteAll(java.lang.Object input,
java.lang.String replace,
int index,
int eflags)
Substitutes the replacement text for each non-overlapping match found in the input text, starting at the specified index and using the specified execution flags. |
private java.lang.String |
substituteAllImpl(CharIndexed input,
java.lang.String replace,
int index,
int eflags)
|
private java.lang.String |
substituteImpl(CharIndexed input,
java.lang.String replace,
int index,
int eflags)
|
static char |
toLowerCase(char ch,
boolean unicodeAware)
Converts the character argument to lowercase. |
java.lang.String |
toString()
Return a human readable form of the compiled regular expression, useful for debugging. |
static char |
toUpperCase(char ch,
boolean unicodeAware)
Converts the character argument to uppercase. |
static java.lang.String |
version()
Returns a string representing the version of the gnu.regexp package. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
VERSION
private static final java.lang.String VERSION
- See Also:
- Constant Field Values
messages
private static java.util.ResourceBundle messages
firstToken
private REToken firstToken
lastToken
private REToken lastToken
numSubs
private int numSubs
minimumLength
private int minimumLength
- Minimum length, in characters, of any possible match.
maximumLength
private int maximumLength
REG_ICASE
public static final int REG_ICASE
- Compilation flag. Do not differentiate case. Subsequent
searches using this RE will be case insensitive.
- See Also:
- Constant Field Values
REG_DOT_NEWLINE
public static final int REG_DOT_NEWLINE
- Compilation flag. The match-any-character operator (dot)
will match a newline character. When set this overrides the syntax
bit RE_DOT_NEWLINE (see RESyntax for details). This is equivalent to
the "/s" operator in Perl.
- See Also:
- Constant Field Values
REG_MULTILINE
public static final int REG_MULTILINE
- Compilation flag. Use multiline mode. In this mode, the ^ and $
anchors will match based on newlines within the input. This is
equivalent to the "/m" operator in Perl.
- See Also:
- Constant Field Values
REG_NOTBOL
public static final int REG_NOTBOL
- Execution flag.
The match-beginning operator (^) will not match at the beginning
of the input string. Useful for matching on a substring when you
know the context of the input is such that position zero of the
input to the match test is not actually position zero of the text.
This example demonstrates the results of various ways of matching on a substring.
String s = "food bar fool";
RE exp = new RE("^foo.");
REMatch m0 = exp.getMatch(s);
REMatch m1 = exp.getMatch(s.substring(8));
REMatch m2 = exp.getMatch(s.substring(8),0,RE.REG_NOTBOL);
REMatch m3 = exp.getMatch(s,8);
REMatch m4 = exp.getMatch(s,8,RE.REG_ANCHORINDEX);
// Results:
// m0.toString(): "food"
// m1.toString(): "fool"
// m2.toString(): null
// m3.toString(): null
// m4.toString(): "fool"
- See Also:
- Constant Field Values
REG_NOTEOL
public static final int REG_NOTEOL
- Execution flag.
The match-end operator ($) does not match at the end
of the input string. Useful for matching on substrings.
- See Also:
- Constant Field Values
REG_ANCHORINDEX
public static final int REG_ANCHORINDEX
- Execution flag.
When a match method is invoked that starts matching at a non-zero
index into the input, treat the input as if it begins at the index
given. The effect of this flag is that the engine does not "see"
any text in the input before the given index. This is useful so
that the match-beginning operator (^) matches not at position 0
in the input string, but at the position the search started at
(based on the index input given to the getMatch function). See
the example under REG_NOTBOL. It also affects the use of the \<
and \b operators.
- See Also:
- Constant Field Values
REG_NO_INTERPOLATE
public static final int REG_NO_INTERPOLATE
- Execution flag.
The substitute and substituteAll methods will not attempt to
interpolate occurrences of $1-$9 in the replacement text with
the corresponding subexpressions. For example, you may want to
replace all matches of "one dollar" with "$1".
- See Also:
- Constant Field Values
REG_TRY_ENTIRE_MATCH
public static final int REG_TRY_ENTIRE_MATCH
- Execution flag.
Try to match the whole input string. An implicit match-end operator
is added to this regexp.
- See Also:
- Constant Field Values
REG_REPLACE_USE_BACKSLASHESCAPE
public static final int REG_REPLACE_USE_BACKSLASHESCAPE
- Execution flag.
The substitute and substituteAll methods will treat the
character '\' in the replacement as an escape to a literal
character. In this case "\n", "\$", "\\", "\x40" and "\012"
will become "n", "$", "\", "x40" and "012" respectively.
This flag has no effect if REG_NO_INTERPOLATE is set on.
- See Also:
- Constant Field Values
REG_X_COMMENTS
public static final int REG_X_COMMENTS
- Compilation flag. Allow whitespace and comments in pattern.
This is equivalent to the "/x" operator in Perl.
- See Also:
- Constant Field Values
REG_ICASE_USASCII
public static final int REG_ICASE_USASCII
- Compilation flag. If set, REG_ICASE is effective only for US-ASCII.
- See Also:
- Constant Field Values
next
protected REToken next
uncle
protected REToken uncle
subIndex
protected int subIndex
unicodeAware
protected boolean unicodeAware
| Constructor Detail |
RE
public RE(java.lang.Object pattern) throws REException
- Constructs a regular expression pattern buffer without any compilation
flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5).
RE
public RE(java.lang.Object pattern, int cflags) throws REException
- Constructs a regular expression pattern buffer using the specified
compilation flags and the default syntax (RESyntax.RE_SYNTAX_PERL5).
RE
public RE(java.lang.Object pattern, int cflags, RESyntax syntax) throws REException
- Constructs a regular expression pattern buffer using the specified
compilation flags and regular expression syntax.
RE
private RE(REToken first, REToken last, int subs, int subIndex, int minLength, int maxLength)
RE
private RE(java.lang.Object patternObj, int cflags, RESyntax syntax, int myIndex, int nextSub) throws REException
RE
protected RE()
| Method Detail |
version
public static final java.lang.String version()
- Returns a string representing the version of the gnu.regexp package.
getLocalizedMessage
static final java.lang.String getLocalizedMessage(java.lang.String key)
initialize
protected void initialize(java.lang.Object patternObj, int cflags, RESyntax syntax, int myIndex, int nextSub) throws REException
parseCharClass
private static RE.ParseCharClassResult parseCharClass(int subIndex, char[] pattern, int index, int pLength, int cflags, RESyntax syntax, int pflags) throws REException
- Parse [...] or [^...] and make an RETokenOneOf instance.
getCharUnit
private static int getCharUnit(char[] input,
int index,
RE.CharUnit unit,
boolean quot)
throws REException
parseInt
private static int parseInt(char[] input,
int pos,
int len,
int radix)
getCharExpression
private static RE.CharExpression getCharExpression(char[] input, int pos, int lim, RESyntax syntax)
getNamedProperty
private static RE.NamedProperty getNamedProperty(char[] input, int pos, int lim)
getRETokenNamedProperty
private static RETokenNamedProperty getRETokenNamedProperty(int subIndex, RE.NamedProperty np, boolean insens, int index) throws REException
isMatch
public boolean isMatch(java.lang.Object input)
- Checks if the regular expression matches the input in its entirety.
isMatch
public boolean isMatch(java.lang.Object input, int index)
- Checks if the input string, starting from index, is an exact match of
this regular expression.
isMatch
public boolean isMatch(java.lang.Object input, int index, int eflags)
- Checks if the input, starting from index and using the specified
execution flags, is an exact match of this regular expression.
isMatchImpl
private boolean isMatchImpl(CharIndexed input, int index, int eflags)
getNumSubs
public int getNumSubs()
- Returns the maximum number of subexpressions in this regular expression.
If the expression contains branches, the value returned will be the
maximum subexpressions in any of the branches.
setUncle
void setUncle(REToken uncle)
chain
boolean chain(REToken next)
getMinimumLength
public int getMinimumLength()
- Returns the minimum number of characters that could possibly
constitute a match of this regular expression.
- Overrides:
getMinimumLengthin classREToken
getMaximumLength
public int getMaximumLength()
- Overrides:
getMaximumLengthin classREToken
getAllMatches
public REMatch[] getAllMatches(java.lang.Object input)
- Returns an array of all matches found in the input.
If the regular expression allows the empty string to match, it will
substitute matches at all positions except the end of the input.
getAllMatches
public REMatch[] getAllMatches(java.lang.Object input, int index)
- Returns an array of all matches found in the input,
beginning at the specified index position.
If the regular expression allows the empty string to match, it will
substitute matches at all positions except the end of the input.
getAllMatches
public REMatch[] getAllMatches(java.lang.Object input, int index, int eflags)
- Returns an array of all matches found in the input string,
beginning at the specified index position and using the specified
execution flags.
If the regular expression allows the empty string to match, it will
substitute matches at all positions except the end of the input.
getAllMatchesImpl
private REMatch[] getAllMatchesImpl(CharIndexed input, int index, int eflags)
match
boolean match(CharIndexed input, REMatch mymatch)
- Description copied from class:
REToken - Returns true if the match succeeded, false if it failed.
findMatch
REMatch findMatch(CharIndexed input, REMatch mymatch)
- Description copied from class:
REToken - Finds a match at the position specified by the given REMatch.
If necessary, adds a BacktrackStack.Backtrack object to backtrackStack
of the REmatch found this time so that another possible match
may be found when backtrack is called.
By default, nothing is added to the backtrackStack.
getMatch
public REMatch getMatch(java.lang.Object input)
- Returns the first match found in the input. If no match is found,
null is returned.
getMatch
public REMatch getMatch(java.lang.Object input, int index)
- Returns the first match found in the input, beginning
the search at the specified index. If no match is found,
returns null.
getMatch
public REMatch getMatch(java.lang.Object input, int index, int eflags)
- Returns the first match found in the input, beginning
the search at the specified index, and using the specified
execution flags. If no match is found, returns null.
getMatch
public REMatch getMatch(java.lang.Object input, int index, int eflags, java.lang.StringBuffer buffer)
- Returns the first match found in the input, beginning the search
at the specified index, and using the specified execution flags.
If no match is found, returns null. If a StringBuffer is
provided and is non-null, the contents of the input text from the
index to the beginning of the match (or to the end of the input,
if there is no match) are appended to the StringBuffer.
getMatchImpl
REMatch getMatchImpl(CharIndexed input, int anchor, int eflags, java.lang.StringBuffer buffer)
getMatchEnumeration
public REMatchEnumeration getMatchEnumeration(java.lang.Object input)
- Returns an REMatchEnumeration that can be used to iterate over the
matches found in the input text.
getMatchEnumeration
public REMatchEnumeration getMatchEnumeration(java.lang.Object input, int index)
- Returns an REMatchEnumeration that can be used to iterate over the
matches found in the input text.
getMatchEnumeration
public REMatchEnumeration getMatchEnumeration(java.lang.Object input, int index, int eflags)
- Returns an REMatchEnumeration that can be used to iterate over the
matches found in the input text.
substitute
public java.lang.String substitute(java.lang.Object input, java.lang.String replace)
- Substitutes the replacement text for the first match found in the input.
substitute
public java.lang.String substitute(java.lang.Object input, java.lang.String replace, int index)
- Substitutes the replacement text for the first match found in the input
beginning at the specified index position. Specifying an index
effectively causes the regular expression engine to throw away the
specified number of characters.
substitute
public java.lang.String substitute(java.lang.Object input, java.lang.String replace, int index, int eflags)
- Substitutes the replacement text for the first match found in the input
string, beginning at the specified index position and using the
specified execution flags.
substituteImpl
private java.lang.String substituteImpl(CharIndexed input, java.lang.String replace, int index, int eflags)
substituteAll
public java.lang.String substituteAll(java.lang.Object input, java.lang.String replace)
- Substitutes the replacement text for each non-overlapping match found
in the input text.
substituteAll
public java.lang.String substituteAll(java.lang.Object input, java.lang.String replace, int index)
- Substitutes the replacement text for each non-overlapping match found
in the input text, starting at the specified index.
If the regular expression allows the empty string to match, it will
substitute matches at all positions except the end of the input.
substituteAll
public java.lang.String substituteAll(java.lang.Object input, java.lang.String replace, int index, int eflags)
- Substitutes the replacement text for each non-overlapping match found
in the input text, starting at the specified index and using the
specified execution flags.
substituteAllImpl
private java.lang.String substituteAllImpl(CharIndexed input, java.lang.String replace, int index, int eflags)
getReplacement
public static java.lang.String getReplacement(java.lang.String replace, REMatch m, int eflags)
addToken
private void addToken(REToken next)
setRepeated
private static REToken setRepeated(REToken current, int min, int max, int index) throws REException
getPosixSet
private static int getPosixSet(char[] pattern,
int index,
java.lang.StringBuffer buf)
getMinMax
private int getMinMax(char[] input,
int index,
RE.IntPair minMax,
RESyntax syntax)
throws REException
toString
public java.lang.String toString()
- Return a human readable form of the compiled regular expression,
useful for debugging.
dump
void dump(java.lang.StringBuffer os)
makeCharIndexed
public static CharIndexed makeCharIndexed(java.lang.Object input, int index)
clone
public java.lang.Object clone()
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
matchThis
REMatch matchThis(CharIndexed input, REMatch mymatch)
- Returns true if the match succeeded, false if it failed.
The matching is done against this REToken only. Chained
tokens are not checked.
This method is used to define the default match method.
Simple subclasses of REToken, for example, such that
matches only one character, should implement this method.
Then the default match method will work. But complicated
subclasses of REToken, which needs a special match method,
do not have to implement this method.
next
protected boolean next(CharIndexed input, REMatch mymatch)
- Returns true if the rest of the tokens match, false if they fail.
getNext
REToken getNext()
- Returns the next REToken chained to this REToken.
returnsFixedLengthMatches
boolean returnsFixedLengthMatches()
findFixedLengthMatches
int findFixedLengthMatches(CharIndexed input, REMatch mymatch, int max)
backtrack
REMatch backtrack(CharIndexed input, REMatch mymatch, java.lang.Object param)
- Backtrack to another possibility.
Ordinary REToken cannot do anything if this method is called.
dumpAll
void dumpAll(java.lang.StringBuffer os)
toLowerCase
public static char toLowerCase(char ch,
boolean unicodeAware)
- Converts the character argument to lowercase.
toUpperCase
public static char toUpperCase(char ch,
boolean unicodeAware)
- Converts the character argument to uppercase.
|
|||||||||
| Home >> All >> gnu >> [ regexp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC