public final class AwkCompiler extends java.lang.Object implements PatternCompiler
The supported regular expression syntax is a superset of traditional AWK, but NOT to be confused with GNU AWK or other AWK variants. Additionally, this AWK implementation is DFA-based and only supports 8-bit ASCII. Consequently, these classes can perform very fast pattern matches in most cases.
This is the traditional Awk syntax that is supported:
This is the extended syntax that is supported:
PatternCompiler
,
MalformedPatternException
,
AwkPattern
,
AwkMatcher
Modifier and Type | Field and Description |
---|---|
static int |
CASE_INSENSITIVE_MASK
A mask passed as an option to the
compile methods
to indicate a compiled regular expression should be case insensitive. |
static int |
DEFAULT_MASK
The default mask for the
compile methods. |
static int |
MULTILINE_MASK
A mask passed as an option to the
compile methods
to indicate a compiled regular expression should treat input as having
multiple lines. |
Constructor and Description |
---|
AwkCompiler() |
Modifier and Type | Method and Description |
---|---|
Pattern |
compile(char[] pattern)
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);
|
Pattern |
compile(char[] pattern,
int options)
Compiles an Awk regular expression into an AwkPattern instance that
can be used by an AwkMatcher object to perform pattern matching.
|
Pattern |
compile(java.lang.String pattern)
Same as calling compile(pattern, AwkCompiler.DEFAULT_MASK);
|
Pattern |
compile(java.lang.String pattern,
int options)
Compiles an Awk regular expression into an AwkPattern instance that
can be used by an AwkMatcher object to perform pattern matching.
|
public static final int DEFAULT_MASK
compile
methods.
It is equal to 0 and indicates no special options are active.public static final int CASE_INSENSITIVE_MASK
compile
methods
to indicate a compiled regular expression should be case insensitive.public static final int MULTILINE_MASK
compile
methods
to indicate a compiled regular expression should treat input as having
multiple lines. This option affects the interpretation of
the . metacharacters. When this mask is used,
the . metacharacter will not match newlines. The default
behavior is for . to match newlines.public Pattern compile(char[] pattern, int options) throws MalformedPatternException
compile
in interface PatternCompiler
pattern
- An Awk regular expression to compile.options
- A set of flags giving the compiler instructions on
how to treat the regular expression. Currently the
only meaningful flag is AwkCompiler.CASE_INSENSITIVE_MASK.MalformedPatternException
- If the compiled expression
is not a valid Awk regular expression.public Pattern compile(java.lang.String pattern, int options) throws MalformedPatternException
compile
in interface PatternCompiler
pattern
- An Awk regular expression to compile.options
- A set of flags giving the compiler instructions on
how to treat the regular expression. Currently the
only meaningful flag is AwkCompiler.CASE_INSENSITIVE_MASK.MalformedPatternException
- If the compiled expression
is not a valid Awk regular expression.public Pattern compile(char[] pattern) throws MalformedPatternException
compile
in interface PatternCompiler
pattern
- A regular expression to compile.MalformedPatternException
- If the compiled expression
is not a valid Awk regular expression.public Pattern compile(java.lang.String pattern) throws MalformedPatternException
compile
in interface PatternCompiler
pattern
- A regular expression to compile.MalformedPatternException
- If the compiled expression
is not a valid Awk regular expression.Copyright ? 2000-2003 Apache Software Foundation. All Rights Reserved.