ok, I also noticed an issue with thousands:
var main = function() {
var doc = app.properties.activeDocument;
if ( !doc ) return;
var fgp = app.findGrepPreferences.properties,
found = [], n, p, t;
app.findGrepPreferences = null;
app.findGrepPreferences.properties = {
findWhat:”€sd{1,3}(.d{3})*(,d+)”,
appliedParagraphStyle:”prezzo”,
}
found = doc.findGrep();
n = found.length;
while ( n– ) {
t = found[n];
p = Number ( t.contents.replace ( /€+/, “”).replace ( /\./g, “” ).replace ( “,”, “.” ) );
t.contents = “€ “+sepThousands( String(Math.floor(p*1.02)) )+ “,00″;
}
}
function sepThousands ( contents ) {
var a = contents.split(‘.’);
var dec = a[1];
var integer = a[0].split(”);
var na = [];
while ( sp = integer.splice ( -3, 3 ) ) {
na[na.length] = sp.join(”);
}
return na.reverse().join(“.”)+(dec? ‘,’+dec : ”);
}
var u;
app.doScript ( “main()”,u,u,UndoModes.ENTIRE_SCRIPT, “The Script” );