|
|||||||||
Home >> All >> com >> jcorporate >> expresso >> ext >> [ regexp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
com.jcorporate.expresso.ext.regexp
Class RE

java.lang.Objectcom.jcorporate.expresso.ext.regexp.RE
Deprecated. since v5.6, use jakarta oro
- public class RE
- extends java.lang.Object
RE is an efficient, lightweight regular expression evaluator/matcher class. Regular expressions are pattern descriptions which enable sophisticated matching of strings. In addition to being able to match a string against a pattern, you can also extract parts of the match. This is especially useful in text parsing! Details on the syntax of regular expression patterns are given below.
To compile a regular expression (RE), you can simply construct an RE matcher object from the string specification of the pattern, like this:RE r = new RE("a*b");Once you have done this, you can call either of the RE.match methods to perform matching on a String. For example:
boolean matched = r.match("aaaab");will cause the boolean matched to be set to true because the pattern "a*b" matches the string "aaaab". If you were interested in the number of a's which matched the first part of our example expression, you could change the expression to "(a*)b". Then when you compiled the expression and matched it against something like "xaaaab", you would get results like this:
RE r = new RE("(a*)b"); // Compile expression boolean matched = r.match("xaaaab"); // Match against "xaaaab"You can also refer to the contents of a parenthesized expression within a regular expression itself. This is called a 'backreference'. The first backreference in a regular expression is denoted by \1, the second by \2 and so on. So the expression:
String wholeExpr = r.getParen(0); // wholeExpr will be 'aaaab' String insideParens = r.getParen(1); // insideParens will be 'aaaa'
int startWholeExpr = getParenStart(0); // startWholeExpr will be index 1 int endWholeExpr = getParenEnd(0); // endWholeExpr will be index 6 int lenWholeExpr = getParenLength(0); // lenWholeExpr will be 5
int startInside = getParenStart(1); // startInside will be index 1 int endInside = getParenEnd(1); // endInside will be index 5 int lenInside = getParenLength(1); // lenInside will be 4
([0-9]+)=\1will match any string of the form n=n (like 0=0 or 2=2). The full regular expression syntax accepted by RE is described here:
All closure operators (+, *, ?, {m,n}) are greedy by default, meaning that they match as many elements of the string as possible without causing the overall match to fail. If you want a closure to be reluctant (non-greedy), you can simply follow it with a '?'. A reluctant closure will match as few elements of the string as possible when finding matches. {m,n} closures don't currently support reluctancy. RE runs programs compiled by the RECompiler class. But the RE matcher class does not include the actual regular expression compiler for reasons of efficiency. In fact, if you want to pre-compile one or more regular expressions, the 'recompile' class can be invoked from the command line to produce compiled output like this:
Characters
unicodeChar Matches any identical unicode character \ Used to quote a meta-character (like '*') \\ Matches a single '\' character \0nnn Matches a given octal character \xhh Matches a given 8-bit hexadecimal character \\uhhhh Matches a given 16-bit hexadecimal character \t Matches an ASCII tab character \n Matches an ASCII newline character \r Matches an ASCII return character \f Matches an ASCII form feed character
Character Classes
[abc] Simple character class [a-zA-Z] Character class with ranges [^abc] Negated character class
Standard POSIX Character Classes
[:alnum:] Alphanumeric characters. [:alpha:] Alphabetic characters. [:blank:] Space and tab characters. [:cntrl:] Control characters. [:digit:] Numeric characters. [:graph:] Characters that are printable and are also visible. (A space is printable, but not visible, while an `a' is both.) [:lower:] Lower-case alphabetic characters. [:print:] Printable characters (characters that are not control characters.) [:punct:] Punctuation characters (characters that are not letter, digits, control characters, or space characters). [:space:] Space characters (such as space, tab, and formfeed, to name a few). [:upper:] Upper-case alphabetic characters. [:xdigit:] Characters that are hexadecimal digits.
Non-standard POSIX-style Character Classes
[:javastart:] Start of a Java identifier [:javapart:] Part of a Java identifier
Predefined Classes
. Matches any character other than newline \w Matches a "word" character (alphanumeric plus "_") \W Matches a non-word character \s Matches a whitespace character \S Matches a non-whitespace character \d Matches a digit character \D Matches a non-digit character
Boundary Matchers
^ Matches only at the beginning of a line $ Matches only at the end of a line \b Matches only at a word boundary \B Matches only at a non-word boundary
Greedy Closures
A* Matches A 0 or more times (greedy) A+ Matches A 1 or more times (greedy) A? Matches A 1 or 0 times (greedy) A{n} Matches A exactly n times (greedy) A{n,} Matches A at least n times (greedy) A{n,m} Matches A at least n but not more than m times (greedy)
Reluctant Closures
A*? Matches A 0 or more times (reluctant) A+? Matches A 1 or more times (reluctant) A?? Matches A 0 or 1 times (reluctant)
Logical Operators
AB Matches A followed by B A|B Matches either A or B (A) Used for subexpression grouping
Backreferences
\1 Backreference to 1st parenthesized subexpression \2 Backreference to 2nd parenthesized subexpression \3 Backreference to 3rd parenthesized subexpression \4 Backreference to 4th parenthesized subexpression \5 Backreference to 5th parenthesized subexpression \6 Backreference to 6th parenthesized subexpression \7 Backreference to 7th parenthesized subexpression \8 Backreference to 8th parenthesized subexpression \9 Backreference to 9th parenthesized subexpression
// Pre-compiled regular expression "a*b" char[] re1Instructions = { 0x007c, 0x0000, 0x001a, 0x007c, 0x0000, 0x000d, 0x0041, 0x0001, 0x0004, 0x0061, 0x007c, 0x0000, 0x0003, 0x0047, 0x0000, 0xfff6, 0x007c, 0x0000, 0x0003, 0x004e, 0x0000, 0x0003, 0x0041, 0x0001, 0x0004, 0x0062, 0x0045, 0x0000, 0x0000, };You can then construct a regular expression matcher (RE) object from the pre-compiled expression re1 and thus avoid the overhead of compiling the expression at runtime. If you require more dynamic regular expressions, you can construct a single RECompiler object and re-use it to compile each expression. Similarly, you can change the program run by a given matcher object at any time. However, RE and RECompiler are not threadsafe (for efficiency reasons, and because requiring thread safety in this class is deemed to be a rare requirement), so you will need to construct a separate compiler or matcher object for each thread (unless you do thread synchronization yourself).
REProgram re1 = new REProgram(re1Instructions);
- com.weusours.util.re is not currently compatible with all standard POSIX regcomp flags
- com.weusours.util.re does not support POSIX equivalence classes ([=foo=] syntax) (I18N/locale issue)
- com.weusours.util.re does not support nested POSIX character classes (definitely should, but not completely trivial)
- com.weusours.util.re Does not support POSIX character collation concepts ([.foo.] syntax) (I18N/locale issue)
- Should there be different matching styles (simple, POSIX, Perl etc?)
- Should RE support character iterators (for backwards RE matching!)?
- Should RE support reluctant {m,n} closures (does anyone care)?
- Not *all* possibilities are considered for greediness when backreferences are involved (as POSIX suggests should be the case). The POSIX RE "(ac*)c*d[ac]*\1", when matched against "acdacaa" should yield a match of acdacaa where \1 is "a". This is not the case in this RE package, and actually Perl doesn't go to this extent either! Until someone actually complains about this, I'm not sure it's worth "fixing". If it ever is fixed, test #137 in RETest.txt should be updated.
- Version:
- $Id: RE.java,v 1.9 2004/11/18 02:03:28 lhamel Exp $
Field Summary | |
(package private) static char |
E_ALNUM
Deprecated. |
(package private) static char |
E_BOUND
Deprecated. |
(package private) static char |
E_DIGIT
Deprecated. |
(package private) static char |
E_NALNUM
Deprecated. |
(package private) static char |
E_NBOUND
Deprecated. |
(package private) static char |
E_NDIGIT
Deprecated. |
(package private) static char |
E_NSPACE
Deprecated. |
(package private) static char |
E_SPACE
Deprecated. |
(package private) int |
end0
Deprecated. |
(package private) int |
end1
Deprecated. |
(package private) int |
end2
Deprecated. |
(package private) int[] |
endBackref
Deprecated. |
(package private) int[] |
endn
Deprecated. |
(package private) int |
idx
Deprecated. |
static int |
MATCH_CASEINDEPENDENT
Deprecated. Flag to indicate that matching should be case-independent (folded) |
static int |
MATCH_MULTILINE
Deprecated. Newlines should match as BOL/EOL (^ and $) |
static int |
MATCH_NORMAL
Deprecated. Specifies normal, case-sensitive matching behaviour. |
(package private) int |
matchFlags
Deprecated. |
(package private) static int |
maxNode
Deprecated. |
(package private) static int |
maxParen
Deprecated. |
(package private) static java.lang.String |
NEWLINE
Deprecated. Line Separator |
(package private) static int |
nodeSize
Deprecated. |
(package private) static int |
offsetNext
Deprecated. |
(package private) static int |
offsetOpcode
Deprecated. |
(package private) static int |
offsetOpdata
Deprecated. |
(package private) static char |
OP_ANY
Deprecated. |
(package private) static char |
OP_ANYOF
Deprecated. |
(package private) static char |
OP_ATOM
Deprecated. |
(package private) static char |
OP_BACKREF
Deprecated. |
(package private) static char |
OP_BOL
Deprecated. |
(package private) static char |
OP_BRANCH
Deprecated. |
(package private) static char |
OP_CLOSE
Deprecated. |
(package private) static char |
OP_END
Deprecated. ********************************************* * The format of a node in a program is: * * [ OPCODE ] [ OPDATA ] [ OPNEXT ] [ OPERAND ] * * char OPCODE - instruction * char OPDATA - modifying data * char OPNEXT - next node (relative offset) * * ********************************************** |
(package private) static char |
OP_EOL
Deprecated. |
(package private) static char |
OP_ESCAPE
Deprecated. |
(package private) static char |
OP_GOTO
Deprecated. |
(package private) static char |
OP_MAYBE
Deprecated. |
(package private) static char |
OP_NOTHING
Deprecated. |
(package private) static char |
OP_OPEN
Deprecated. |
(package private) static char |
OP_PLUS
Deprecated. |
(package private) static char |
OP_POSIXCLASS
Deprecated. |
(package private) static char |
OP_RELUCTANTMAYBE
Deprecated. |
(package private) static char |
OP_RELUCTANTPLUS
Deprecated. |
(package private) static char |
OP_RELUCTANTSTAR
Deprecated. |
(package private) static char |
OP_STAR
Deprecated. |
(package private) int |
parenCount
Deprecated. |
(package private) static char |
POSIX_CLASS_ALNUM
Deprecated. |
(package private) static char |
POSIX_CLASS_ALPHA
Deprecated. |
(package private) static char |
POSIX_CLASS_BLANK
Deprecated. |
(package private) static char |
POSIX_CLASS_CNTRL
Deprecated. |
(package private) static char |
POSIX_CLASS_DIGIT
Deprecated. |
(package private) static char |
POSIX_CLASS_GRAPH
Deprecated. |
(package private) static char |
POSIX_CLASS_JPART
Deprecated. |
(package private) static char |
POSIX_CLASS_JSTART
Deprecated. |
(package private) static char |
POSIX_CLASS_LOWER
Deprecated. |
(package private) static char |
POSIX_CLASS_PRINT
Deprecated. |
(package private) static char |
POSIX_CLASS_PUNCT
Deprecated. |
(package private) static char |
POSIX_CLASS_SPACE
Deprecated. |
(package private) static char |
POSIX_CLASS_UPPER
Deprecated. |
(package private) static char |
POSIX_CLASS_XDIGIT
Deprecated. |
(package private) REProgram |
program
Deprecated. |
static int |
REPLACE_ALL
Deprecated. Flag bit that indicates that subst should replace all occurrences of this regular expression. |
static int |
REPLACE_FIRSTONLY
Deprecated. Flag bit that indicates that subst should only replace the first occurrence of this regular expression. |
(package private) CharacterIterator |
search
Deprecated. |
(package private) int |
start0
Deprecated. |
(package private) int |
start1
Deprecated. |
(package private) int |
start2
Deprecated. |
(package private) int[] |
startBackref
Deprecated. |
(package private) int[] |
startn
Deprecated. |
Constructor Summary | |
RE()
Deprecated. Constructs a regular expression matcher with no initial program. |
|
RE(REProgram program)
Deprecated. Construct a matcher for a pre-compiled regular expression from program (bytecode) data. |
|
RE(REProgram program,
int matchFlags)
Deprecated. Construct a matcher for a pre-compiled regular expression from program (bytecode) data. |
|
RE(java.lang.String pattern)
Deprecated. Constructs a regular expression matcher from a String by compiling it using a new instance of RECompiler. |
|
RE(java.lang.String pattern,
int matchFlags)
Deprecated. Constructs a regular expression matcher from a String by compiling it using a new instance of RECompiler. |
Method Summary | |
private void |
allocParens()
Deprecated. Performs lazy allocation of subexpression arrays |
int |
getMatchFlags()
Deprecated. Returns the current match behaviour flags. |
java.lang.String |
getParen(int which)
Deprecated. Gets the contents of a parenthesized subexpression after a successful match. |
int |
getParenCount()
Deprecated. Returns the number of parenthesized subexpressions available after a successful match. |
int |
getParenEnd(int which)
Deprecated. Returns the end index of a given paren level. |
int |
getParenLength(int which)
Deprecated. Returns the length of a given paren level. |
int |
getParenStart(int which)
Deprecated. Returns the start index of a given paren level. |
REProgram |
getProgram()
Deprecated. Returns the current regular expression program in use by this matcher object. |
java.lang.String[] |
grep(java.lang.Object[] search)
Deprecated. Returns an array of Strings, whose toString representation matches a regular expression. |
protected void |
internalError(java.lang.String s)
Deprecated. Throws an Error representing an internal error condition probably resulting from a bug in the regular expression compiler (or possibly data corruption). |
private boolean |
isNewline(int i)
Deprecated. |
boolean |
match(CharacterIterator search,
int i)
Deprecated. Matches the current regular expression program against a character array, starting at a given index. |
boolean |
match(java.lang.String search)
Deprecated. Matches the current regular expression program against a String. |
boolean |
match(java.lang.String search,
int i)
Deprecated. Matches the current regular expression program against a character array, starting at a given index. |
protected boolean |
matchAt(int i)
Deprecated. Match the current regular expression program against the current input string, starting at index i of the input string. |
protected int |
matchNodes(int firstNode,
int lastNode,
int idxStart)
Deprecated. Try to match a string against a subset of nodes in the program |
void |
setMatchFlags(int matchFlags)
Deprecated. Sets match behaviour flags which alter the way RE does matching. |
protected void |
setParenEnd(int which,
int i)
Deprecated. Sets the end of a paren level |
protected void |
setParenStart(int which,
int i)
Deprecated. Sets the start of a paren level |
void |
setProgram(REProgram program)
Deprecated. Sets the current regular expression program used by this matcher object. |
static java.lang.String |
simplePatternToFullRegularExpression(java.lang.String pattern)
Deprecated. Converts a 'simplified' regular expression to a full regular expression |
java.lang.String[] |
split(java.lang.String s)
Deprecated. Splits a string into an array of strings on regular expression boundaries. |
java.lang.String |
subst(java.lang.String substituteIn,
java.lang.String substitution)
Deprecated. Substitutes a string for this regular expression in another string. |
java.lang.String |
subst(java.lang.String substituteIn,
java.lang.String substitution,
int flags)
Deprecated. Substitutes a string for this regular expression in another string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
MATCH_NORMAL
public static final int MATCH_NORMAL
- Deprecated.
- Specifies normal, case-sensitive matching behaviour.
- See Also:
- Constant Field Values
- Specifies normal, case-sensitive matching behaviour.
MATCH_CASEINDEPENDENT
public static final int MATCH_CASEINDEPENDENT
- Deprecated.
- Flag to indicate that matching should be case-independent (folded)
- See Also:
- Constant Field Values
- Flag to indicate that matching should be case-independent (folded)
MATCH_MULTILINE
public static final int MATCH_MULTILINE
- Deprecated.
- Newlines should match as BOL/EOL (^ and $)
- See Also:
- Constant Field Values
- Newlines should match as BOL/EOL (^ and $)
OP_END
static final char OP_END
- Deprecated.
- ********************************************* * The format of a node in a program is: * * [ OPCODE ] [ OPDATA ] [ OPNEXT ] [ OPERAND ] * * char OPCODE - instruction * char OPDATA - modifying data * char OPNEXT - next node (relative offset) * * **********************************************
- See Also:
- Constant Field Values
- ********************************************* * The format of a node in a program is: * * [ OPCODE ] [ OPDATA ] [ OPNEXT ] [ OPERAND ] * * char OPCODE - instruction * char OPDATA - modifying data * char OPNEXT - next node (relative offset) * * **********************************************
OP_BOL
static final char OP_BOL
- Deprecated.
- See Also:
- Constant Field Values
OP_EOL
static final char OP_EOL
- Deprecated.
- See Also:
- Constant Field Values
OP_ANY
static final char OP_ANY
- Deprecated.
- See Also:
- Constant Field Values
OP_ANYOF
static final char OP_ANYOF
- Deprecated.
- See Also:
- Constant Field Values
OP_BRANCH
static final char OP_BRANCH
- Deprecated.
- See Also:
- Constant Field Values
OP_ATOM
static final char OP_ATOM
- Deprecated.
- See Also:
- Constant Field Values
OP_STAR
static final char OP_STAR
- Deprecated.
- See Also:
- Constant Field Values
OP_PLUS
static final char OP_PLUS
- Deprecated.
- See Also:
- Constant Field Values
OP_MAYBE
static final char OP_MAYBE
- Deprecated.
- See Also:
- Constant Field Values
OP_ESCAPE
static final char OP_ESCAPE
- Deprecated.
- See Also:
- Constant Field Values
OP_OPEN
static final char OP_OPEN
- Deprecated.
- See Also:
- Constant Field Values
OP_CLOSE
static final char OP_CLOSE
- Deprecated.
- See Also:
- Constant Field Values
OP_BACKREF
static final char OP_BACKREF
- Deprecated.
- See Also:
- Constant Field Values
OP_GOTO
static final char OP_GOTO
- Deprecated.
- See Also:
- Constant Field Values
OP_NOTHING
static final char OP_NOTHING
- Deprecated.
- See Also:
- Constant Field Values
OP_RELUCTANTSTAR
static final char OP_RELUCTANTSTAR
- Deprecated.
- See Also:
- Constant Field Values
OP_RELUCTANTPLUS
static final char OP_RELUCTANTPLUS
- Deprecated.
- See Also:
- Constant Field Values
OP_RELUCTANTMAYBE
static final char OP_RELUCTANTMAYBE
- Deprecated.
- See Also:
- Constant Field Values
OP_POSIXCLASS
static final char OP_POSIXCLASS
- Deprecated.
- See Also:
- Constant Field Values
E_ALNUM
static final char E_ALNUM
- Deprecated.
- See Also:
- Constant Field Values
E_NALNUM
static final char E_NALNUM
- Deprecated.
- See Also:
- Constant Field Values
E_BOUND
static final char E_BOUND
- Deprecated.
- See Also:
- Constant Field Values
E_NBOUND
static final char E_NBOUND
- Deprecated.
- See Also:
- Constant Field Values
E_SPACE
static final char E_SPACE
- Deprecated.
- See Also:
- Constant Field Values
E_NSPACE
static final char E_NSPACE
- Deprecated.
- See Also:
- Constant Field Values
E_DIGIT
static final char E_DIGIT
- Deprecated.
- See Also:
- Constant Field Values
E_NDIGIT
static final char E_NDIGIT
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_ALNUM
static final char POSIX_CLASS_ALNUM
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_ALPHA
static final char POSIX_CLASS_ALPHA
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_BLANK
static final char POSIX_CLASS_BLANK
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_CNTRL
static final char POSIX_CLASS_CNTRL
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_DIGIT
static final char POSIX_CLASS_DIGIT
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_GRAPH
static final char POSIX_CLASS_GRAPH
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_LOWER
static final char POSIX_CLASS_LOWER
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_PRINT
static final char POSIX_CLASS_PRINT
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_PUNCT
static final char POSIX_CLASS_PUNCT
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_SPACE
static final char POSIX_CLASS_SPACE
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_UPPER
static final char POSIX_CLASS_UPPER
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_XDIGIT
static final char POSIX_CLASS_XDIGIT
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_JSTART
static final char POSIX_CLASS_JSTART
- Deprecated.
- See Also:
- Constant Field Values
POSIX_CLASS_JPART
static final char POSIX_CLASS_JPART
- Deprecated.
- See Also:
- Constant Field Values
maxNode
static final int maxNode
- Deprecated.
- See Also:
- Constant Field Values
maxParen
static final int maxParen
- Deprecated.
- See Also:
- Constant Field Values
offsetOpcode
static final int offsetOpcode
- Deprecated.
- See Also:
- Constant Field Values
offsetOpdata
static final int offsetOpdata
- Deprecated.
- See Also:
- Constant Field Values
offsetNext
static final int offsetNext
- Deprecated.
- See Also:
- Constant Field Values
nodeSize
static final int nodeSize
- Deprecated.
- See Also:
- Constant Field Values
NEWLINE
static final java.lang.String NEWLINE
- Deprecated.
- Line Separator
- Line Separator
program
REProgram program
- Deprecated.
search
CharacterIterator search
- Deprecated.
idx
int idx
- Deprecated.
matchFlags
int matchFlags
- Deprecated.
parenCount
int parenCount
- Deprecated.
start0
int start0
- Deprecated.
end0
int end0
- Deprecated.
start1
int start1
- Deprecated.
end1
int end1
- Deprecated.
start2
int start2
- Deprecated.
end2
int end2
- Deprecated.
startn
int[] startn
- Deprecated.
endn
int[] endn
- Deprecated.
startBackref
int[] startBackref
- Deprecated.
endBackref
int[] endBackref
- Deprecated.
REPLACE_ALL
public static final int REPLACE_ALL
- Deprecated.
- Flag bit that indicates that subst should replace all occurrences of this regular expression.
- See Also:
- Constant Field Values
- Flag bit that indicates that subst should replace all occurrences of this regular expression.
REPLACE_FIRSTONLY
public static final int REPLACE_FIRSTONLY
- Deprecated.
- Flag bit that indicates that subst should only replace the first occurrence of this regular expression.
- See Also:
- Constant Field Values
- Flag bit that indicates that subst should only replace the first occurrence of this regular expression.
Constructor Detail |
RE
public RE()
- Deprecated.
- Constructs a regular expression matcher with no initial program. This is likely to be an uncommon practice, but is still supported.
- Constructs a regular expression matcher with no initial program. This is likely to be an uncommon practice, but is still supported.
RE
public RE(REProgram program)
- Deprecated.
- Construct a matcher for a pre-compiled regular expression from program (bytecode) data.
- Construct a matcher for a pre-compiled regular expression from program (bytecode) data.
RE
public RE(REProgram program, int matchFlags)
- Deprecated.
- Construct a matcher for a pre-compiled regular expression from program (bytecode) data. Permits special flags to be passed in to modify matching behaviour.
- Construct a matcher for a pre-compiled regular expression from program (bytecode) data. Permits special flags to be passed in to modify matching behaviour.
RE
public RE(java.lang.String pattern) throws RESyntaxException
- Deprecated.
- Constructs a regular expression matcher from a String by compiling it using a new instance of RECompiler. If you will be compiling many expressions, you may prefer to use a single RECompiler object instead.
- Constructs a regular expression matcher from a String by compiling it using a new instance of RECompiler. If you will be compiling many expressions, you may prefer to use a single RECompiler object instead.
RE
public RE(java.lang.String pattern, int matchFlags) throws RESyntaxException
- Deprecated.
- Constructs a regular expression matcher from a String by compiling it using a new instance of RECompiler. If you will be compiling many expressions, you may prefer to use a single RECompiler object instead.
- Constructs a regular expression matcher from a String by compiling it using a new instance of RECompiler. If you will be compiling many expressions, you may prefer to use a single RECompiler object instead.
Method Detail |
allocParens
private final void allocParens()
- Deprecated.
- Performs lazy allocation of subexpression arrays
- Performs lazy allocation of subexpression arrays
getMatchFlags
public int getMatchFlags()
- Deprecated.
- Returns the current match behaviour flags.
- Returns the current match behaviour flags.
getParen
public java.lang.String getParen(int which)
- Deprecated.
- Gets the contents of a parenthesized subexpression after a successful match.
- Gets the contents of a parenthesized subexpression after a successful match.
getParenCount
public int getParenCount()
- Deprecated.
- Returns the number of parenthesized subexpressions available after a successful match.
- Returns the number of parenthesized subexpressions available after a successful match.
getParenEnd
public final int getParenEnd(int which)
- Deprecated.
- Returns the end index of a given paren level.
- Returns the end index of a given paren level.
getParenLength
public final int getParenLength(int which)
- Deprecated.
- Returns the length of a given paren level.
- Returns the length of a given paren level.
getParenStart
public final int getParenStart(int which)
- Deprecated.
- Returns the start index of a given paren level.
- Returns the start index of a given paren level.
getProgram
public REProgram getProgram()
- Deprecated.
- Returns the current regular expression program in use by this matcher object.
- Returns the current regular expression program in use by this matcher object.
grep
public java.lang.String[] grep(java.lang.Object[] search)
- Deprecated.
- Returns an array of Strings, whose toString representation matches a regular expression. This method works like the Perl function of the same name. Given a regular expression of "a*b" and an array of String objects of [foo, aab, zzz, aaaab], the array of Strings returned by grep would be [aab, aaaab].
- Returns an array of Strings, whose toString representation matches a regular expression. This method works like the Perl function of the same name. Given a regular expression of "a*b" and an array of String objects of [foo, aab, zzz, aaaab], the array of Strings returned by grep would be [aab, aaaab].
internalError
protected void internalError(java.lang.String s) throws java.lang.Error
- Deprecated.
- Throws an Error representing an internal error condition probably resulting from a bug in the regular expression compiler (or possibly data corruption). In practice, this should be very rare.
- Throws an Error representing an internal error condition probably resulting from a bug in the regular expression compiler (or possibly data corruption). In practice, this should be very rare.
isNewline
private boolean isNewline(int i)
- Deprecated.
match
public boolean match(CharacterIterator search, int i)
- Deprecated.
- Matches the current regular expression program against a character array, starting at a given index.
- Matches the current regular expression program against a character array, starting at a given index.
match
public boolean match(java.lang.String search)
- Deprecated.
- Matches the current regular expression program against a String.
- Matches the current regular expression program against a String.
match
public boolean match(java.lang.String search, int i)
- Deprecated.
- Matches the current regular expression program against a character array, starting at a given index.
- Matches the current regular expression program against a character array, starting at a given index.
matchAt
protected boolean matchAt(int i)
- Deprecated.
- Match the current regular expression program against the current input string, starting at index i of the input string. This method is only meant for internal use.
- Match the current regular expression program against the current input string, starting at index i of the input string. This method is only meant for internal use.
matchNodes
protected int matchNodes(int firstNode, int lastNode, int idxStart)
- Deprecated.
- Try to match a string against a subset of nodes in the program
- Try to match a string against a subset of nodes in the program
setMatchFlags
public void setMatchFlags(int matchFlags)
- Deprecated.
- Sets match behaviour flags which alter the way RE does matching.
- Sets match behaviour flags which alter the way RE does matching.
setParenEnd
protected final void setParenEnd(int which, int i)
- Deprecated.
- Sets the end of a paren level
- Sets the end of a paren level
setParenStart
protected final void setParenStart(int which, int i)
- Deprecated.
- Sets the start of a paren level
- Sets the start of a paren level
setProgram
public void setProgram(REProgram program)
- Deprecated.
- Sets the current regular expression program used by this matcher object.
- Sets the current regular expression program used by this matcher object.
simplePatternToFullRegularExpression
public static java.lang.String simplePatternToFullRegularExpression(java.lang.String pattern)
- Deprecated.
- Converts a 'simplified' regular expression to a full regular expression
- Converts a 'simplified' regular expression to a full regular expression
split
public java.lang.String[] split(java.lang.String s)
- Deprecated.
- Splits a string into an array of strings on regular expression boundaries. This function works the same way as the Perl function of the same name. Given a regular expression of "[ab]+" and a string to split of "xyzzyababbayyzabbbab123", the result would be the array of Strings "[xyzzy, yyz, 123]".
- Splits a string into an array of strings on regular expression boundaries. This function works the same way as the Perl function of the same name. Given a regular expression of "[ab]+" and a string to split of "xyzzyababbayyzabbbab123", the result would be the array of Strings "[xyzzy, yyz, 123]".
subst
public java.lang.String subst(java.lang.String substituteIn, java.lang.String substitution)
- Deprecated.
- Substitutes a string for this regular expression in another string. This method works like the Perl function of the same name. Given a regular expression of "a*b", a String to substituteIn of "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the resulting String returned by subst would be "-foo-garply-wacky-".
- Substitutes a string for this regular expression in another string. This method works like the Perl function of the same name. Given a regular expression of "a*b", a String to substituteIn of "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the resulting String returned by subst would be "-foo-garply-wacky-".
subst
public java.lang.String subst(java.lang.String substituteIn, java.lang.String substitution, int flags)
- Deprecated.
- Substitutes a string for this regular expression in another string. This method works like the Perl function of the same name. Given a regular expression of "a*b", a String to substituteIn of "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the resulting String returned by subst would be "-foo-garply-wacky-".
- Substitutes a string for this regular expression in another string. This method works like the Perl function of the same name. Given a regular expression of "a*b", a String to substituteIn of "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the resulting String returned by subst would be "-foo-garply-wacky-".
|
|||||||||
Home >> All >> com >> jcorporate >> expresso >> ext >> [ regexp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |