Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.condition

public Class Matches

extends ProjectComponent
implements Condition
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.taskdefs.condition.Condition
Imports
org.apache.tools.ant.BuildException, .ProjectComponent, org.apache.tools.ant.types.RegularExpression, org.apache.tools.ant.util.regexp.Regexp, .RegexpUtil

Simple regular expression condition.
Since
Ant 1.7

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private RegularExpression
private boolean
private String
Inherited from org.apache.tools.ant.ProjectComponent:
descriptionlocationproject

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addRegexp(RegularExpression
the regular expression object to be configured as an element
regularExpression
)

A regular expression.

public boolean

Returns:

true if the string matches the regular expression pattern
eval
()

Implements org.apache.tools.ant.taskdefs.condition.Condition.eval.

Is this condition true?
public void
setCasesensitive(boolean
if false, ignore case.
b
)

Whether to ignore case or not.

public void
setMultiline(boolean
the value to set.
b
)

Whether to match should be multiline.

public void
setPattern(String
the regular expression pattern
pattern
)

Set the regular expression to match against

public void
setSingleLine(boolean
the value to set.
b
)

Whether to treat input as singleline ('.' matches newline).

public void
setString(String
the string to match
string
)

Set the string

Inherited from org.apache.tools.ant.ProjectComponent:
clonegetDescriptiongetLocationgetProjectloglogsetDescriptionsetLocationsetProject

Field Detail

caseSensitiveback to summary
private boolean caseSensitive
multiLineback to summary
private boolean multiLine
regularExpressionback to summary
private RegularExpression regularExpression
singleLineback to summary
private boolean singleLine
stringback to summary
private String string

Constructor Detail

Matchesback to summary
public Matches()

Method Detail

addRegexpback to summary
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:RegularExpression

the regular expression object to be configured as an element

evalback to summary
public boolean eval() throws BuildException

Implements org.apache.tools.ant.taskdefs.condition.Condition.eval.

Doc from org.apache.tools.ant.taskdefs.condition.Condition.eval.

Is this condition true?

Returns:boolean

true if the string matches the regular expression pattern

Exceptions
BuildException:
if the attributes are not set correctly
setCasesensitiveback to summary
public void setCasesensitive(boolean b)

Whether to ignore case or not.

Parameters
b:boolean

if false, ignore case.

Since
Ant 1.7
setMultilineback to summary
public void setMultiline(boolean b)

Whether to match should be multiline.

Parameters
b:boolean

the value to set.

setPatternback to summary
public void setPattern(String pattern)

Set the regular expression to match against

Parameters
pattern:String

the regular expression pattern

setSingleLineback to summary
public void setSingleLine(boolean b)

Whether to treat input as singleline ('.' matches newline). Corresponds to java.util.regex.Pattern.DOTALL.

Parameters
b:boolean

the value to set.

setStringback to summary
public void setString(String string)

Set the string

Parameters
string:String

the string to match