How to modify:
var a = ' z this is ok z ';
a = a.replace(/z(.*)z/, function(match){ return match.trim().toUpperCase();});
console.log(a); // output: " Z THIS IS OK Z "
I expect " ZTHIS IS OKZ ";
the uppercase work, but the trim function is ignored