Package org.apache.shiro.util
Class RegExPatternMatcher
- java.lang.Object
-
- org.apache.shiro.util.RegExPatternMatcher
-
- All Implemented Interfaces:
PatternMatcher
public class RegExPatternMatcher extends Object implements PatternMatcher
PatternMatcher
implementation that uses standardjava.util.regex
objects.- Since:
- 1.0
- See Also:
Pattern
-
-
Constructor Summary
Constructors Constructor Description RegExPatternMatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isCaseInsensitive()
Returns true if regex match should be case-insensitive.boolean
matches(String pattern, String source)
Simple implementation that merely uses the default pattern comparison logic provided by the JDK.void
setCaseInsensitive(boolean caseInsensitive)
Adds the Pattern.CASE_INSENSITIVE flag when compiling patterns.
-
-
-
Method Detail
-
matches
public boolean matches(String pattern, String source)
Simple implementation that merely uses the default pattern comparison logic provided by the JDK. This implementation essentially executes the following:Pattern p = Pattern.compile(pattern, Pattern.DOTALL); Matcher m = p.matcher(source); return m.matches();
- Specified by:
matches
in interfacePatternMatcher
- Parameters:
pattern
- the pattern to match againstsource
- the source to match- Returns:
true
if the source matches the required pattern,false
otherwise.
-
isCaseInsensitive
public boolean isCaseInsensitive()
Returns true if regex match should be case-insensitive.- Returns:
- true if regex match should be case-insensitive.
-
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive)
Adds the Pattern.CASE_INSENSITIVE flag when compiling patterns.- Parameters:
caseInsensitive
- true if patterns should match case-insensitive.
-
-