/** expands glob, including custom syntax for numeric part, but to an array, and re-throwing the checked exception as a runtime exception */ public String[] expandToArrayUnchecked(String glob) { try { return expand(glob).toArray(new String[0]); } catch (InvalidPatternException e) { throw Throwables.propagate(e); } }
/** returns true iff the target matches the given pattern, * under simplified bash rules -- viz permitting * and ? and comma delimited patterns inside curly braces, * as well as things like {1,2,5-10} (and also {01,02,05-10} to keep leading 0) * @throws InvalidPatternException */ public boolean isGlobMatchedNumeric(String globPattern, String targetText) throws InvalidPatternException { List<String> patterns = expand(globPattern); for (String p : patterns) { if (isNoBraceGlobMatched(p, targetText)) return true; } return false; }