net.sf.mmm.util.pattern.base
Class RegexInfixPatternCompiler
java.lang.Object
net.sf.mmm.util.pattern.base.RegexPatternCompiler
net.sf.mmm.util.pattern.base.RegexInfixPatternCompiler
- All Implemented Interfaces:
- PatternCompiler
public class RegexInfixPatternCompiler
- extends RegexPatternCompiler
This implementation of the 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".
ATTENTION:
On the matcher of the produced
Pattern you may want to use Matcher.find()
instead of Matcher.matches().
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final PatternCompiler INSTANCE
- A singleton instance of this implementation.
RegexInfixPatternCompiler
public RegexInfixPatternCompiler()
- The constructor.
RegexInfixPatternCompiler
public RegexInfixPatternCompiler(int flags)
- The constructor.
- Parameters:
flags - are the compiler flags.
compile
public Pattern compile(String pattern)
throws IllegalArgumentException
-
- Specified by:
compile in interface PatternCompiler- Overrides:
compile in class RegexPatternCompiler
- Parameters:
pattern - is the expression to be compiled as pattern.
- Returns:
- the compiled pattern. May only return
null if
explicitly documented by the underlying implementation. E.g. if the
given pattern is just a plain string without
wildcards.
- Throws:
IllegalArgumentException - if the given pattern has
illegal syntax for the underlying compiler.- See Also:
Pattern.compile(String)
Copyright © 2001-2010 mmm-Team. All Rights Reserved.