{"ScriptPreparationCode":"var field = \u0022event_data.param.parms[0][\u0027hello\u0027]\u0022","TestCases":[{"Name":"regex ","Code":"\r\n // replaces the start of the string with \u0022[\u0027\u0022, if it starts with \u0022[\u0022\r\n str = field.replace(/^(?!\\[)/, \u0022[\u0027\u0022)\r\n\r\n // replaces the end of the string with \u0022\u0027]\u0022, if it does ends with \u0022]\u0022\r\n .replace(/^(?\u003C!\\])(.*)(?\u003C!\\])$/, \u0022$1\u0027]\u0022)\r\n\r\n // replaces the middle dots with \u0022\u0027][\u0027\u0022 if there is not \u0022]\u0022 before the dot and no \u0022[\u0022 after the dot\r\n .replace(/(?\u003C!\\])(?\u003C=[^\\]])\\.(?=[^\\[])(?!\\[)/g, \u0022\u0027][\u0027\u0022)\r\n\r\n // replaces all \u0022].\u0022 with \u0022][\u0027\u0022\r\n .replace(/\\]\\./g, \u0022][\u0027\u0022)\r\n\r\n // replaces all \u0022.[\u0022 with \u0022\u0027][\u0022\r\n .replace(/\\.\\[/g, \u0022\u0027][\u0022)\r\n\r\n // replaces all \u0022[\u0022 that are in the middle of the string, if there is no \u0022]\u0022 before it\r\n .replace(/(?\u003C=[^\\]]\u002B)\\[(?=[^\\[]\u002B)/g, \u0022\u0027][\u0022);\r\n\r\n\treturn str;","IsDeferred":false},{"Name":"loops","Code":" if (field.startsWith(\u0027[\u0027)) {\r\n return field;\r\n } else {\r\n let arr = field.split(\u0022.\u0022);\r\n let newStr = \u0022\u0022;\r\n for (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n if ( arr[i].includes(\u0027\\[\u0027) ) {\r\n let [first, ...rest] = arr[i].split(\u0027[\u0027);\r\n rest = rest.join(\u0027\u0027);\r\n newStr \u002B= \u0060[\\\u0027${first}\\\u0027][${rest}\u0060;\r\n }\r\n else {\r\n newStr \u002B= \u0060[\\\u0027${arr[i]}\\\u0027]\u0060;\r\n }\r\n }\r\n return newStr;\r\n }","IsDeferred":false}]}