public class RegExPatternMatcher extends Object implements PatternMatcher
PatternMatcher
implementation that uses standard java.util.regex
objects.Pattern
Constructor and Description |
---|
RegExPatternMatcher() |
Modifier and Type | Method and Description |
---|---|
boolean |
matches(String pattern,
String source)
Simple implementation that merely uses the default pattern comparison logic provided by the
JDK.
|
public RegExPatternMatcher()
public boolean matches(String pattern, String source)
Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(source); return m.matches();
matches
in interface PatternMatcher
pattern
- the pattern to match againstsource
- the source to matchtrue
if the source matches the required pattern, false
otherwise.Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.