Regexp (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.util.regexp, interface: Regexp

# Interface Regexp

All Superinterfaces:
  `RegexpMatcher`

All Known Implementing Classes:
  `JakartaOroRegexp, JakartaRegexpRegexp, Jdk14RegexpRegexp`

public interface Regexp extends RegexpMatcher
Interface which represents a regular expression, and the operations that can be performed on it.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `REPLACE_ALL`
  Replace all occurrences of the regular expression
  `static final int`
  `REPLACE_FIRST`
  Replace only the first occurrence of the regular expression

  ### Fields inherited from interface RegexpMatcher

  `MATCH_CASE_INSENSITIVE, MATCH_DEFAULT, MATCH_MULTILINE, MATCH_SINGLELINE`
  Modifier and Type
  Field
  Description
  `static final int`
  `MATCH_CASE_INSENSITIVE`
  Perform a case insensitive match
  `static final int`
  `MATCH_DEFAULT`
  Default Mask (case insensitive, neither multiline nor singleline specified).
  `static final int`
  `MATCH_MULTILINE`
  Treat the input as a multiline input
  `static final int`
  `MATCH_SINGLELINE`
  Treat the input as singleline input ('.' matches newline)

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `substitute(String input, String argument, int options)`
  Perform a substitution on the regular expression.

  ### Methods inherited from interface RegexpMatcher

  `getGroups, getGroups, getPattern, matches, matches, setPattern`
  Modifier and Type
  Method
  Description
  `Vector<String>`
  `getGroups(String argument)`
  Returns a Vector of matched groups found in the argument using default options.
  `Vector<String>`
  `getGroups(String input, int options)`
  Get the match groups from this regular expression.
  `String`
  `getPattern()`
  Get a String representation of the regexp pattern
  `boolean`
  `matches(String argument)`
  Does the given argument match the pattern?
  `boolean`
  `matches(String input, int options)`
  Does this regular expression match the input, given certain options
  `void`
  `setPattern(String pattern)`
  Set the regexp pattern from the String description.

- ## Field Details

  - ### REPLACE_FIRST

    static final int REPLACE_FIRST
    Replace only the first occurrence of the regular expression
    See Also:
      - Constant Field Values

  - ### REPLACE_ALL

    static final int REPLACE_ALL
    Replace all occurrences of the regular expression
    See Also:
      - Constant Field Values

- ## Method Details

  - ### substitute

    String substitute(String input, String argument, int options) throws BuildException
    Perform a substitution on the regular expression.
    Parameters:
      `input` - The string to substitute on
      `argument` - The string which defines the substitution
      `options` - The list of options for the match and replace. See the MATCH_ and REPLACE_ constants above.
    Returns:
      the result of the operation
    Throws:
      `BuildException` - on error