/** * Returns a Vector of matched groups found in the argument * using default options. * * <p>Group 0 will be the full match, the rest are the * parenthesized subexpressions</p>. * * @param argument the string to match against * @return the vector of groups * @throws BuildException on error */ @Override public Vector<String> getGroups(String argument) throws BuildException { return getGroups(argument, MATCH_DEFAULT); }
/** * Does the given argument match the pattern using default options? * @param argument the string to match against * @return true if the pattern matches * @throws BuildException on error */ @Override public boolean matches(String argument) throws BuildException { return matches(argument, MATCH_DEFAULT); }
/** * Does the given argument match the pattern? * @param input the string to match against * @param options the regex options to use * @return true if the pattern matches * @throws BuildException on error */ @Override public boolean matches(String input, int options) throws BuildException { try { return getCompiledPattern(options).matcher(input).find(); } catch (Exception e) { throw new BuildException(e); } }
/** * Get a compiled representation of the regexp pattern * @param options the options * @return the compiled pattern * @throws BuildException on error */ protected Pattern getCompiledPattern(int options) throws BuildException { try { return Pattern.compile(this.pattern, getCompilerOptions(options)); } catch (PatternSyntaxException e) { throw new BuildException(e); } }
/*** * Create a new regular expression instance. * * @param p Project whose ant.regexp.regexpimpl property will be used. * @return the matcher * @throws BuildException on error */ public RegexpMatcher newRegexpMatcher(Project p) throws BuildException { String systemDefault; if (p == null) { systemDefault = System.getProperty(MagicNames.REGEXP_IMPL); } else { systemDefault = p.getProperty(MagicNames.REGEXP_IMPL); } if (systemDefault != null) { return createInstance(systemDefault); // TODO should we silently catch possible exceptions and try to // load a different implementation? } return new Jdk14RegexpMatcher(); }
public Vector<String> getGroups(String input, int options) throws BuildException { Pattern p = getCompiledPattern(options); Matcher matcher = p.matcher(input); if (!matcher.find()) {