Abel
March 5, 2025, 6:41am
1
1.Below comments is not recognized in running, no matter // or /**/ , it will show " * [error] variable “I” is not defined"
2.Regex doesn’t work
var strCD = "AAA01";//${Arr[${i}][0]}.trim();
var CD_Tp = "Any";
if ( /^[A-Z]{3}$/.test(strCD) ){
CD_Tp = "Internal Code";
} elseif ( /^[A-Z]{3}\d{2}$/.test(strCD) ){
CD_Tp = "Internal Code";
} elseif ( /^[A-Z]{5}$/.test(strCD) ){
CD_Tp = "UNLocode";
}
return CD_Tp;
version is 9.5.1
uiuser
March 5, 2025, 9:16am
2
var strCD = "AAA01";
var CD_Tp = "Any";
if (/^[A-Z]{3}$/.test(strCD)) {
CD_Tp = "Internal Code";
} else if (/^[A-Z]{3}\d{2}$/.test(strCD)) {
CD_Tp = "Internal Code";
} else if (/^[A-Z]{5}$/.test(strCD)) {
CD_Tp = "UNLocode";
}
return CD_Tp;
1 Like
Abel
March 5, 2025, 9:34am
3
Thank you for reminder for space between ‘else’ and ‘if’. But it shows "
*E501: [Firefox only] executeScript_Sandbox does not support regular expressions."
1 Like
uiuser
March 5, 2025, 9:42am
4
It is working in Chrome
{
"Command": "executeScript_Sandbox",
"Target": "var strCD = \"AAA01\";\n\n\nvar CD_Tp = \"Any\";\n\nif (/^[A-Z]{3}$/.test(strCD)) {\n CD_Tp = \"Internal Code\";\n} else if (/^[A-Z]{3}\\d{2}$/.test(strCD)) {\n CD_Tp = \"Internal Code\";\n} else if (/^[A-Z]{5}$/.test(strCD)) {\n CD_Tp = \"UNLocode\";\n}\n\nreturn CD_Tp;\n",
"Value": "aa",
"Description": ""
},
{
"Command": "echo",
"Target": "${aa}",
"Value": "",
"Description": ""
}
1 Like
admin
March 5, 2025, 9:50am
5
You are both correct. Unfortunately executeScript_Sandbox can not process regular expressions in Firefox . Other than that, it works the same as in Chrome and Edge.
For technical reasons and workarounds please see this regular expressions post .