Hi @Plankton @Timo @thecoder2012 @ulrich
I use a javascript to replace but this javascript NOT replace the exact match word i need the replacement exact word.
With this javascript if i have AAAHOME it replace in BBBHOME
I need only replacement if the value is AAA replace in BBB
In this case this javascript must NOT replace nothing because there are not exact match
My macro code
{
"Name": "ZZZ Replace_Multiple",
"CreationDate": "2020-2-11",
"Commands": [
{
"Command": "store",
"Target": "AAAHELLOBBB",
"Value": "MyVar"
},
{
"Command": "executeScript_Sandbox",
"Target": "var mystring = ${MyVar}; var replaced = mystring.replace(/AAA/g, \"ZZZ\").replace(/BBB/g, \"TTT\"); return replaced",
"Value": "MyNewvar"
},
{
"Command": "echo",
"Target": "${MyNewVar}",
"Value": ""
}
]
}
Log
[status]
Playing macro ZZZ Replace_Multiple
[info]
Executing: | store | AAAHELLOBBB | MyVar |
[info]
Executing: | executeScript_Sandbox | var mystring = ${MyVar}; var replaced = mystring.replace(/AAA/g, “ZZZ”).replace(/BBB/g, “TTT”); return replaced | MyNewvar |
[info]
Executing: | echo | ${MyNewVar} | |
[echo]
ZZZHELLOTTT
[info]
Macro completed (Runtime 1.17s)
Thanks to all