Use javascript’s .replace() method, stringing multiple replace’s together. ie:
var somestring = "foo is an awesome foo bar foo foo"; //somestring lowercase
var replaced = somestring.replace(/foo/g, "bar").replace(/is/g, "or");
// replaced now contains: "bar or an awesome bar bar bar bar"
This code will be run inside executescript_sandbox with ${in} and ${out} variables.
executescript_sandbox | var somestring = ${in}; var replaced = somestring.replace(/foo/g, “bar”).replace(/is/g, “or”); return replaced | out
If i have a long list of terms to replace how can i do this
example i have var ${pet} i need to convert values inside the var with this list (first element replaced with first element, second element replaced with second element …)
I need it to replace value saved in variables for example to putting value in sites translated into several languages it’s more easy to save one value and after traslate the value inside the variable via macro code.
I search the fast way to do this, actually i know how to replace 1 single value for time but this create a long macro code (and slow) I prefer a short and fast way.
Can you post an example of your code adding a variable !COL1 inside the value to replace please ?