private String checkSpec(String spec) { java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("[A-Za-z0-9:-_,\\-\\.*]+"); Matcher matcher = pattern.matcher(spec); if (!matcher.matches()) { throw new IllegalArgumentException( spec + ": Pattern names can consist of alphabetic " + "characters plus :, _, -, and .. A wildcard '*' may be included to match a " + "string of such characters."); } spec = spec.replace(".", "\\."); return spec; }
private Set<MyNode> getExtent(String spec) { Set<String> split = split(spec); Set<MyNode> matches = new HashSet<>(); for (String _spec : split) { _spec = _spec.replace("*", ".*"); java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(_spec); for (MyNode var : myNodes) { Matcher matcher = pattern.matcher(var.getName()); if (matcher.matches()) { matches.add(var); } } } return matches; }
private boolean checkVarName(String name) { java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("[A-Za-z0-9:_\\-\\.]+"); Matcher matcher = pattern.matcher(name); return matcher.matches(); }