/** * Convert ant regexp substitution option to jdk1.4 options. * * @param options the ant regexp options * @return the jdk14 substitution options */ protected int getSubsOptions(int options) { int subsOptions = REPLACE_FIRST; if (RegexpUtil.hasFlag(options, REPLACE_ALL)) { subsOptions = REPLACE_ALL; } return subsOptions; }
/** * Convert the generic options to the regex compiler specific options. * @param options the generic options * @return the specific options */ protected int getCompilerOptions(int options) { // be strict about line separator int cOptions = Pattern.UNIX_LINES; if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) { cOptions |= Pattern.CASE_INSENSITIVE; } if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) { cOptions |= Pattern.MULTILINE; } if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) { cOptions |= Pattern.DOTALL; } return cOptions; }
if (RegexpUtil.hasFlag(sOptions, REPLACE_ALL)) { sb.append(m.replaceAll(subst.toString())); } else if (m.find()) {
/** * Creates a new LineContainsRegExp using the passed in * Reader for instantiation. * * @param rdr A Reader object providing the underlying stream. * Must not be <code>null</code>. * * @return a new filter based on this configuration, but filtering * the specified reader */ public Reader chain(final Reader rdr) { LineContainsRegExp newFilter = new LineContainsRegExp(rdr); newFilter.setRegexps(getRegexps()); newFilter.setNegate(isNegated()); newFilter.setCaseSensitive(!RegexpUtil.hasFlag(regexpOptions, Regexp.MATCH_CASE_INSENSITIVE)); return newFilter; }
/** * Convert ant regexp substitution option to oro options. * * @param options the ant regexp options * @return the oro substitution options */ protected int getSubsOptions(final int options) { return RegexpUtil.hasFlag(options, REPLACE_ALL) ? Util.SUBSTITUTE_ALL : 1; }
/** * Convert ant regexp substitution option to apache regex options. * * @param options the ant regexp options * @return the apache regex substitution options */ protected int getSubsOptions(int options) { int subsOptions = RE.REPLACE_FIRSTONLY; if (RegexpUtil.hasFlag(options, REPLACE_ALL)) { subsOptions = RE.REPLACE_ALL; } return subsOptions; }
/** * Convert the generic options to the regex compiler specific options. * @param options the generic options * @return the specific options */ protected int getCompilerOptions(final int options) { int cOptions = Perl5Compiler.DEFAULT_MASK; if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) { cOptions |= Perl5Compiler.CASE_INSENSITIVE_MASK; } if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) { cOptions |= Perl5Compiler.MULTILINE_MASK; } if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) { cOptions |= Perl5Compiler.SINGLELINE_MASK; } return cOptions; }
/** * Convert the generic options to the regex compiler specific options. * @param options the generic options * @return the specific options */ protected int getCompilerOptions(int options) { int cOptions = RE.MATCH_NORMAL; if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) { cOptions |= RE.MATCH_CASEINDEPENDENT; } if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) { cOptions |= RE.MATCH_MULTILINE; } if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) { cOptions |= RE.MATCH_SINGLELINE; } return cOptions; }