org.apache.tools.ant.taskdefs.condition

Class Matches

public class Matches extends ProjectComponent implements Condition

Simple regular expression condition.

Since: Ant 1.7

Method Summary
voidaddRegexp(RegularExpression regularExpression)
A regular expression.
booleaneval()
voidsetCasesensitive(boolean b)
Whether to ignore case or not.
voidsetMultiline(boolean b)
Whether to match should be multiline.
voidsetPattern(String pattern)
Set the regular expression to match against
voidsetSingleLine(boolean b)
Whether to treat input as singleline ('.' matches newline).
voidsetString(String string)
Set the string

Method Detail

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

eval

public boolean eval()

Returns: true if the string matches the regular expression pattern

Throws: BuildException if the attributes are not set correctly

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.

setPattern

public void setPattern(String pattern)
Set the regular expression to match against

Parameters: pattern the regular expression pattern

setSingleLine

public void setSingleLine(boolean b)
Whether to treat input as singleline ('.' matches newline). Corresponsds to java.util.regex.Pattern.DOTALL.

Parameters: b the value to set.

setString

public void setString(String string)
Set the string

Parameters: string the string to match