org.codehaus.janino.util
public class StringPattern extends Object
Additionally, the concept of the "combined pattern" is supported (see
(StringPattern[], String)
.
Field Summary | |
---|---|
static int | EXCLUDE |
static int | INCLUDE |
static StringPattern[] | PATTERNS_ALL |
static StringPattern[] | PATTERNS_NONE |
Constructor Summary | |
---|---|
StringPattern(int mode, String pattern) | |
StringPattern(String pattern) |
Method Summary | |
---|---|
int | getMode() |
boolean | matches(String text)
Match the given text against the pattern represented by the current instance,
as follows:
|
static boolean | matches(StringPattern[] patterns, String text)
Match a given text against an array of StringPatterns (which was
typically created by parseCombinedPattern.
|
static StringPattern[] | parseCombinedPattern(String combinedPattern)
Parse a "combined pattern" into an array of StringPatterns. |
String | toString() |
See Also: (StringPattern[], String)
See Also: (StringPattern[], String)
text
against the pattern represented by the current instance,
as follows:
*
in the pattern matches any sequence of zero or more characters in the
text
?
in the pattern matches exactly one character in the text
text
mode
flag of the current instance does not take any effect here.text
against an array of StringPatterns (which was
typically created by parseCombinedPattern.
The last matching pattern takes effect; if its mode is INCLUDE, then
true
is returned, if its mode is EXCLUDE, then false
is
returned.
If patterns
is PATTERNS_NONE, or empty, or none of its patterns
matches, then false
is returned.
If patterns
is PATTERNS_ALL, then true
is
returned.
For backwards compatibility, null
patterns are treated like
PATTERNS_NONE.
combined-pattern := [ '+' | '-' ] pattern { ( '+' | '-' ) pattern }If a pattern is preceeded with a '-', then the StringPattern is created with mode EXCLUDE, otherwise with mode INCLUDE.