private String from;
private String to;
private RegularExpression regularExpression;
private Substitution substitution;
private boolean initialized = false;
private String flags = "";
private int options;
private Regexp regexp;
/**
* @param from the regex pattern
*/
/**
* the from attribute
* @param from the regex string
*/
public void setPattern(String from) {
this.from = from;
}
/**
* @param to the replacement string
*/
/**
* the to attribute
* @param to the replacement string
*/
public void setReplace(String to) {
this.to = to;
}
/**
* @param flags the regex flags
*/
public void setFlags(String flags) {
this.flags = flags;
}
private void initialize() {
if (initialized) {
return;
}
options = convertRegexOptions(flags);
if (from == null) {
throw new BuildException( [[#variablefdb0d00]]);
}
regularExpression = new RegularExpression();
regularExpression.setPattern(from);
regexp = regularExpression.getRegexp(getProject());
if (to == null) {
[[#variablefdd3ae0]]
}
substitution = new Substitution();
substitution.setExpression(to);
}
|