TokenFilter.ContainsRegex (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.filters, class: TokenFilter, class: ContainsRegex

# Class TokenFilter.ContainsRegex

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.filters.TokenFilter.ChainableReaderFilter
org.apache.tools.ant.filters.TokenFilter.ContainsRegex

All Implemented Interfaces:
  `Cloneable, ChainableReader, TokenFilter.Filter`

Enclosing class:
  `TokenFilter`

public static class TokenFilter.ContainsRegex extends TokenFilter.ChainableReaderFilter
filter to filter tokens matching regular expressions.

Since:
  Ant 1.6

- ## Field Summary

  ### Fields inherited from class ProjectComponent

  `description, location, project`
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  Deprecated.
  since 1.6.x.
  `protected Location`
  `location`
  Deprecated.
  since 1.6.x.
  `protected Project`
  `project`
  Deprecated.
  since 1.6.x.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContainsRegex()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `filter(String string)`
  apply regex and substitution on a string
  `void`
  `setFlags(String flags)`
  `void`
  `setPattern(String from)`
  `void`
  `setReplace(String to)`

  ### Methods inherited from class TokenFilter.ChainableReaderFilter

  `chain, setByLine`
  Modifier and Type
  Method
  Description
  `Reader`
  `chain(Reader reader)`
  Chain a tokenfilter reader to a reader,
  `void`
  `setByLine(boolean byLine)`
  set whether to use filetokenizer or line tokenizer

  ### Methods inherited from class ProjectComponent

  `clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `String`
  `getDescription()`
  Returns the description of the current action.
  `Location`
  `getLocation()`
  Returns the file/location where this task was defined.
  `Project`
  `getProject()`
  Returns the project to which this component belongs.
  `void`
  `log(String msg)`
  Logs a message with the default (INFO) priority.
  `void`
  `log(String msg, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `setDescription(String desc)`
  Sets a description of the current action.
  `void`
  `setLocation(Location location)`
  Sets the file/location where this task was defined.
  `void`
  `setProject(Project project)`
  Sets the project object of this component.

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ContainsRegex

    public ContainsRegex()

- ## Method Details

  - ### setPattern

    public void setPattern(String from)
    Parameters:
      `from` - the regex pattern

  - ### setReplace

    public void setReplace(String to)
    Parameters:
      `to` - the replacement string

  - ### setFlags

    public void setFlags(String flags)
    Parameters:
      `flags` - the regex flags

  - ### filter

    public String filter(String string)
    apply regex and substitution on a string
    Parameters:
      `string` - the string to apply filter on
    Returns:
      the filtered string