I'm sure some regex can do wonder but I would simply create a custom Task.
Within your task, you can define a new property with the getProjet().setProperty()
method.
Something like the following should suffice:
public class PreviousMonthTask extends Task {
private String currentDate;
private String propertyName;
public void setCurrentDate(String currentDate) {
this.currentDate = currentDate;
}
public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}
@Override
public void execute() throws BuildException {
// calculate the previous month
String previousMonth = ...;
getProject().setProperty(this.propertyName, previousMonth);
}
}
What's left to do is to define a properties file with a link to the class:
previousmonth = org.myproject.PreviousMonthTask
When you load the task (see the Ant documentation), you just have to invoke your task with:
<previousmonth propertyName="previous" currentDate="${current}"/>