To slice of parts of a string, use the “substring” JS function. The internal var ${!URL}
contains the current URL.
executeScript_Sandbox | var s = ${!URL}; s = s.substring(s.lastIndexOf("=") + 1, s.length); return s; | number
Test macro:
{
"Name": "slice",
"CreationDate": "2020-5-9",
"Commands": [
{
"Command": "store",
"Target": "nameofthewebsite.com/PHP?ref_id=12345",
"Value": "myurl"
},
{
"Command": "executeScript_Sandbox",
"Target": "var s = ${myurl}; s = s.substring(s.lastIndexOf(\"=\") + 1, s.length); return s; ",
"Value": "n"
},
{
"Command": "echo",
"Target": "${n}",
"Value": "lime"
}
]
}