Package io.github.connellite.match
Class WildcardMatching
java.lang.Object
io.github.connellite.match.WildcardMatching
Glob-style wildcard matching for character sequences.
'?' matches exactly one arbitrary character; '*' matches any sequence of characters
(including empty). Matching is greedy in the dynamic-programming sense: the full text matches the
full pattern if some assignment of * spans satisfies all literals and '?'.
Time and space complexity are O(m·n) for text length m and pattern length n.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisMatch(CharSequence text, CharSequence pattern) Returns whethertextmatchespattern.
-
Constructor Details
-
WildcardMatching
public WildcardMatching()
-
-
Method Details
-
isMatch
Returns whethertextmatchespattern.- Parameters:
text- text to match; not nullpattern- pattern with'?'and'*'wildcards; not null- Returns:
trueif the wholetextmatches the wholepattern
-