RobertKyle wrote:
..
My idea is to find the whole date string, coerce it to a date object, add one day, then extract the new string.
Good idea, except that the next day of "12.12.2013" simply is "13.12.2013" (but I get your point).
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = /\b\d\d?\.\d\d?\.201\d\b/.source;
var dates = app.documents[0].findGrep(true); for (i=0; i<dates.length; i++){ parts = dates[i].contents.split('.'); next = new Date(Number(parts[2]),Number(parts[1])-1,Number(parts[0])+1); dates[i].contents = ('0'+String(next.getDate())).substr(-2)+'.'+('0'+String(next.getMonth()+1)).substr(-2)+'.'+next.getFullYear();}
.. a side effect is that it automatically resolves 'bad dates' such as "29.02.2014" -- technically, this would be "01.03.2014" and so the next date is calculated as "02.03.2014".