Methods Summary |
---|
public void | addRegexp(org.apache.tools.ant.types.RegularExpression regularExpression)A regular expression.
You can use this element to refer to a previously
defined regular expression datatype instance
if (this.regularExpression != null) {
throw new BuildException(
"Only one regular expression is allowed.");
}
this.regularExpression = regularExpression;
|
public boolean | eval()
if (string == null) {
throw new BuildException(
"Parameter string is required in matches.");
}
if (regularExpression == null) {
throw new BuildException("Missing pattern in matches.");
}
int options = RegexpMatcher.MATCH_DEFAULT;
if (!caseSensitive) {
options = options | RegexpMatcher.MATCH_CASE_INSENSITIVE;
}
if (multiLine) {
options = options | RegexpMatcher.MATCH_MULTILINE;
}
if (singleLine) {
options = options | RegexpMatcher.MATCH_SINGLELINE;
}
Regexp regexp = regularExpression.getRegexp(getProject());
return regexp.matches(string, options);
|
public void | setCasesensitive(boolean b)Whether to ignore case or not.
caseSensitive = b;
|
public void | setMultiline(boolean b)Whether to match should be multiline.
multiLine = b;
|
public void | setPattern(java.lang.String pattern)Set the regular expression to match against
if (regularExpression != null) {
throw new BuildException(
"Only one regular expression is allowed.");
}
regularExpression = new RegularExpression();
regularExpression.setPattern(pattern);
|
public void | setSingleLine(boolean b)Whether to treat input as singleline ('.' matches newline).
Corresponsds to java.util.regex.Pattern.DOTALL.
singleLine = b;
|
public void | setString(java.lang.String string)Set the string
this.string = string;
|