/** * Sets the "from" pattern. Required. * @param from the from pattern. * @throws BuildException on error. */ @Override public void setFrom(String from) throws BuildException { if (from == null) { throw new BuildException("this mapper requires a 'from' attribute"); } try { reg.setPattern(from); } catch (NoClassDefFoundError e) { // depending on the implementation the actual RE won't // get instantiated in the constructor. throw new BuildException("Cannot load regular expression matcher", e); } }
RegexpMatcherFactory matchMaker = new RegexpMatcherFactory(); RegexpMatcher matcher = matchMaker.newRegexpMatcher(); matcher.setPattern(r.regex); for (String name : props.keySet()) { if (matcher.matches(name)) {