- "" Match none
- "*" Match all
- "prefix*" Prefix match
- "*suffix" Suffix match
- "prefix*suffix" Prefix and suffix match
- "*infix*" Infix match
- "prefix*infix*" Prefix and infix match
- "*infix*suffix" Infix and suffix match
- "prefix*infix*suffix" Prefix, infix, and suffix match
- "exact_value" Exact match
Any consecutive sequence of '*' are combined into a single '*'.
All matchers are thread-safe.
WildcardPatternMatcher
are measured typically 2 to 100 times as fast as Pattern
,
and have been measured up to 2000 times as fast in contrived scenarios (suffix match on long strings),
and should never be slower in their limited use-case domain.
TODO: Support "**" as an escape for literal '*' in matching? No longer collapse adjacent '*'?
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic WildcardPatternMatcher
Gets the matcher for the comma and/or space separated patterns.boolean
isEmpty()
Checks if this is empty (has no patterns).abstract boolean
static WildcardPatternMatcher
matchAll()
Gets the match all matcher.static WildcardPatternMatcher
Gets the match none matcher.
-
Method Details
-
matchNone
Gets the match none matcher. -
matchAll
Gets the match all matcher. -
compile
Gets the matcher for the comma and/or space separated patterns.Any null or empty pattern matches none.
TODO: New optional flag to limit the matchers to disable the infix matching. The prefix and suffix matches will always be fast O(n), but the infix matching can be O(n^2). This may be useful with public facing search forms, for example.
-
isEmpty
public boolean isEmpty()Checks if this is empty (has no patterns). Any empty matcher does not match anything. -
isMatch
-