List of utility methods to do Wildcard Match
boolean | wildCardMatch(String text, String pattern) test the text match the wild char "*" if (pattern == null || pattern.length() < 1 || "*".equals(pattern)) { return true; if (text == null || text.length() < 1) { return false; String[] cards = pattern.split("\\*"); for (String card : cards) { ... |
boolean | wildCardMatch(String text, String wildcard) Performs a WildCard matching for the text and pattern provided. if (wildcard == null || text == null) { return wildcard == null && text == null; return text.matches(wildcardToRegex(wildcard)); |
boolean | wildcardMatches(String pattern, String text) Check if pattern string matches text string. text += '\0'; pattern += '\0'; int N = pattern.length(); boolean[] states = new boolean[N + 1]; boolean[] old = new boolean[N + 1]; old[0] = true; for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); ... |