code: public static final boolean matches(String text, String pattern) {
  
  		// Simple patterns
  		if (pattern.indexOf('?') == -1) {
  
  			// Exact match (eg. "prefix.event")
  			final int firstStarPosition = pattern.indexOf('*');
  			if (firstStarPosition == -1) {
  				return pattern.equals(text);
  			}
  
  			// Eg. "prefix**"
  			final int len = pattern.length();
  			if (len > 2 && pattern.endsWith("**") && firstStarPosition > len - 3) {
  				pattern = pattern.substring(0, len - 2);
  				return text.startsWith(pattern);
  			}
  
  			// Eg. "prefix*"
  			if (len > 1 && pattern.endsWith("*") && firstStarPosition > len - 2) {
  				pattern = pattern.substring(0, len - 1);
  				if (text.startsWith(pattern)) {
  					return text.indexOf('.', len) == -1;
  				}
  				return false;
  			}
  
  			// Accept simple text, without point character (*)
  			if (len == 1 && firstStarPosition == 0) {
  				return text.indexOf('.') == -1;
  			}
  
  			// Accept all inputs (**)
  			if (len == 2 && firstStarPosition == 0 && pattern.lastIndexOf('*') == 1) {
  				return true;
  			}
  		}
  
  		// Regex (eg. "prefix.ab?cd.*.foo")
  		Pattern regex = regexCache.get(pattern);
  		if (regex == null) {
  			String regexPattern = pattern;
  			if (regexPattern.startsWith("$")) {
  				regexPattern = '\\' + regexPattern;
  			}
  			regexPattern = regexPattern.replace("?", ".");
  			regexPattern = regexPattern.replace("**", "§§§");
  			regexPattern = regexPattern.replace("*", "[^\\.]*");
  			regexPattern = regexPattern.replace("§§§", ".*");
  			regex = Pattern.compile("^" + regexPattern + "$");
  			regexCache.put(regexPattern, regex);
  		}
  		return regex.matcher(text).matches();
  	}
docs: --- MATCHER ---