Package org.apache.tools.ant.taskdefs.condition

# Class Matches

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.taskdefs.condition.Matches

All Implemented Interfaces:
  `Cloneable`, `Condition`

public class Matches extends ProjectComponent implements Condition
Simple regular expression condition.

Since:
  Ant 1.7

- ## Field Summary

  ### Fields inherited from class org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Matches()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addRegexp(RegularExpression regularExpression)`
  A regular expression.
  `boolean`
  `eval()`
  Is this condition true?
  `void`
  `setCasesensitive(boolean b)`
  Whether to ignore case or not.
  `void`
  `setMultiline(boolean b)`
  Whether to match should be multiline.
  `void`
  `setPattern(String pattern)`
  Set the regular expression to match against
  `void`
  `setSingleLine(boolean b)`
  Whether to treat input as singleline ('.' matches newline).
  `void`
  `setString(String string)`
  Set the string

  ### Methods inherited from class org.apache.tools.ant.ProjectComponent

  `clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### Matches

    public Matches()

- ## Method Details

  - ### setString

    public void setString(String string)
    Set the string
    Parameters:
      `string` - the string to match

  - ### setPattern

    public void setPattern(String pattern)
    Set the regular expression to match against
    Parameters:
      `pattern` - the regular expression pattern

  - ### addRegexp

    public void addRegexp(RegularExpression regularExpression)
    A regular expression. You can use this element to refer to a previously defined regular expression datatype instance
    Parameters:
      `regularExpression` - the regular expression object to be configured as an element

  - ### setCasesensitive

    public void setCasesensitive(boolean b)
    Whether to ignore case or not.
    Parameters:
      `b` - if false, ignore case.
    Since:
      Ant 1.7

  - ### setMultiline

    public void setMultiline(boolean b)
    Whether to match should be multiline.
    Parameters:
      `b` - the value to set.

  - ### setSingleLine

    public void setSingleLine(boolean b)
    Whether to treat input as singleline ('.' matches newline). Corresponds to java.util.regex.Pattern.DOTALL.
    Parameters:
      `b` - the value to set.

  - ### eval

    public boolean eval() throws BuildException
    Description copied from interface: `Condition`
    Is this condition true?
    Specified by:
      `eval` in interface `Condition`
    Returns:
      true if the string matches the regular expression pattern
    Throws:
      `BuildException` - if the attributes are not set correctly