So far, I’ve found two bugs:
Passing a function as the second parameter of String.replace doesn’t work:
var object = { firstName: ‘Tommy’, lastName: ‘Valand’ };
var template = ‘{lastName}, {firstName}’
template.replace( /{(\w+)}/g, function( item, key ){
return object[key] || '';
});
The result should be: “Valand, Tommy”
The result is: “,”
String.replace in Server Side JS does not accept a function as the second parameter.
String.match with global modifier:
var template = ‘{lastName}, {firstName}’;
template.match( /{(\w+)}/g );
The result should be: [“{lastName}”, “{firstName}”]
The result is: [“{lastName}”, “lastName”]
String.match in Server Side JS ignores the global modifier.
The worst part… The above JavaScript code works with Client JavaScript in Notes, which I believe was introduced in Notes 5.0… :\