public class RegexInfixPatternCompiler extends RegexPatternCompiler
PatternCompiler
interface compiles the pattern
given as string in a way
similar to GNU-utilities like sed
or grep
. This means that if no leading "^" (or ".*") or no trailing
"$" (or ".*") is present, an according ".*" prefix and suffix is added implicit. This causes that "\.xml$" matches
"config.xml" and "^/etc/" matches "/etc/passwd". matcher
of the produced Pattern
you may want to use
Matcher.find()
instead of Matcher.matches()
.Modifier and Type | Field and Description |
---|---|
static PatternCompiler |
INSTANCE
A singleton instance of this implementation.
|
Constructor and Description |
---|
RegexInfixPatternCompiler()
The constructor.
|
RegexInfixPatternCompiler(int flags)
The constructor.
|
public static final PatternCompiler INSTANCE
public RegexInfixPatternCompiler()
public RegexInfixPatternCompiler(int flags)
flags
- are the compiler flags
.public Pattern compile(String pattern) throws IllegalArgumentException
compile
in interface PatternCompiler
compile
in class RegexPatternCompiler
pattern
- is the expression to be compiled as pattern.null
if explicitly documented by the underlying
implementation. E.g. if the given pattern
is just a plain string without wildcards.IllegalArgumentException
- if the given pattern
has illegal syntax for the underlying compiler.Pattern.compile(String)
Copyright © 2001–2016 mmm-Team. All rights reserved.