gnu.regexp
Class UncheckedRE
java.lang.Object
gnu.regexp.RE
gnu.regexp.UncheckedRE
- All Implemented Interfaces:
- java.io.Serializable
public final class UncheckedRE
- extends RE
UncheckedRE is a subclass of RE that allows programmers an easier means
of programmatically precompiling regular expressions. It is constructed
and used in exactly the same manner as an instance of the RE class; the
only difference is that its constructors do not throw REException.
Instead, if a syntax error is encountered during construction, a
RuntimeException will be thrown.
Note that this makes UncheckedRE dangerous if constructed with
dynamic data. Do not use UncheckedRE unless you are completely sure
that all input being passed to it contains valid, well-formed
regular expressions for the syntax specified.
- Since:
- gnu.regexp 1.1.4
- See Also:
RE
,
Serialized Form
Field Summary |
protected gnu.regexp.REToken |
next
|
protected int |
subIndex
|
protected gnu.regexp.REToken |
uncle
|
Constructor Summary |
UncheckedRE(java.lang.Object pattern)
Constructs a regular expression pattern buffer without any compilation
flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5). |
UncheckedRE(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). |
UncheckedRE(java.lang.Object pattern,
int cflags,
RESyntax syntax)
Constructs a regular expression pattern buffer using the specified
compilation flags and regular expression syntax. |
Method Summary |
protected boolean |
next(CharIndexed input,
REMatch mymatch)
Returns true if the rest of the tokens match, false if they fail. |
Methods inherited from class gnu.regexp.RE |
getAllMatches, getAllMatches, getAllMatches, getMatch, getMatch, getMatch, getMatch, getMatchEnumeration, getMatchEnumeration, getMatchEnumeration, getMinimumLength, getNumSubs, initialize, isMatch, isMatch, isMatch, substitute, substitute, substitute, substituteAll, substituteAll, substituteAll, toString, version |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
next
protected gnu.regexp.REToken next
uncle
protected gnu.regexp.REToken uncle
subIndex
protected int subIndex
UncheckedRE
public UncheckedRE(java.lang.Object pattern)
- Constructs a regular expression pattern buffer without any compilation
flags set, and using the default syntax (RESyntax.RE_SYNTAX_PERL5).
- Parameters:
pattern
- A regular expression pattern, in the form of a String,
StringBuffer or char[]. Other input types will be converted to
strings using the toString() method.
- Throws:
java.lang.RuntimeException
- The input pattern could not be parsed.
java.lang.NullPointerException
- The pattern was null.
UncheckedRE
public UncheckedRE(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).
- Parameters:
pattern
- A regular expression pattern, in the form of a String,
StringBuffer, or char[]. Other input types will be converted to
strings using the toString() method.cflags
- The logical OR of any combination of the compilation flags in the RE class.
- Throws:
java.lang.RuntimeException
- The input pattern could not be parsed.
java.lang.NullPointerException
- The pattern was null.
UncheckedRE
public UncheckedRE(java.lang.Object pattern,
int cflags,
RESyntax syntax)
- Constructs a regular expression pattern buffer using the specified
compilation flags and regular expression syntax.
- Parameters:
pattern
- A regular expression pattern, in the form of a String,
StringBuffer, or char[]. Other input types will be converted to
strings using the toString() method.cflags
- The logical OR of any combination of the compilation flags in the RE class.syntax
- The type of regular expression syntax to use.
- Throws:
java.lang.RuntimeException
- The input pattern could not be parsed.
java.lang.NullPointerException
- The pattern was null.
next
protected boolean next(CharIndexed input,
REMatch mymatch)
- Returns true if the rest of the tokens match, false if they fail.