Package org.apache.juneau.utils
Class StringExpressionMatcher
java.lang.Object
org.apache.juneau.utils.StringExpressionMatcher
Utility class for matching strings against string expressions.
Supports the following string constructs:
"foo" - Single arguments."foo,bar,baz" - Multiple OR'ed arguments."foo | bar | bqz" - Multiple OR'ed arguments, pipe syntax."foo || bar || bqz" - Multiple OR'ed arguments, Java-OR syntax."fo*" - Patterns including'*' and'?' ."fo* & *oo" - Multiple AND'ed arguments, ampersand syntax."fo* && *oo" - Multiple AND'ed arguments, Java-AND syntax."fo* || (*oo || bar)" - Parenthesis.
Notes:
- AND operations take precedence over OR operations (as expected).
- Whitespace is ignored.
null or empty expressions always match asfalse .
See Also:
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
StringExpressionMatcher
Constructor.- Parameters:
expression
- The string expression.- Throws:
ParseException
- Malformed input encountered.
-
-
Method Details
-
matches
Returnstrue if the specified string matches this expression.- Parameters:
input
- The input string.- Returns:
true if the specified string matches this expression.
Alwaysfalse if the string isnull .
-
toString
-
getTokens
Returns all the tokens used in this expression.- Returns:
- All the tokens used in this expression.
-