storeEval Javascript [error] Error in runEval code: Invalid or unexpected token


#1

Hello when I run some Javascript code with storeEval I’ve got an error message:
[error] Error in runEval code: Invalid or unexpected token.

I want to clean a string from space and new line characters, so I put a string into a variable and I’m trying just to display it inside the storeEval, but it does not work, here is my code:

sourceExtract | regex=(?<=Date:</div>\s+<div class=“admin_list_item_two”>)\n\t\t.*\t\t(?=</div>) | ${date}

variable ${date} contains this string: “\n\t\t 07-09-2018 22:30\t\t”

storeEval | x="${date}"; | date_clean

Please help.


storeText does not work with newline and multi levels
#2

I confirmed the problem. My guess is that it has to do with the escape sequences in your string. => I created a ticket for it and we will fix this soon.

From my own test, here is a complete macro that shows the same issue:

{
  "CreationDate": "2018-9-11",
  "Commands": [
    {
      "Command": "echo",
      "Target": "\\n\\t\\t 07-09-2018 22:30\\t\\t",
      "Value": "blue"
    },
    {
      "Command": "store",
      "Target": "\\n\\t\\t 07-09-2018 22:30\\t\\t",
      "Value": "aaa"
    },
    {
      "Command": "storeEval",
      "Target": "x=\"${aaa}\"",
      "Value": "bbb"
    }
  ]
}