Reputation: 17
I want to remove duplicate empty lines in the extracted text
I've tried these:
set title eval("var b='{{!extract}}'; var s = b.replace(/\n\s*\n/g, '\n'); s;")
set title eval("var b=\"{{!extract}}\"; var s = b.replace(/\n\s*\n/g, '\n'); s;")
but the result is the same:
SyntaxError: unterminated regular expression literal, line 10 (Error code: -1001)
What am i doing wrong?
Upvotes: 2
Views: 1554
Reputation: 33544
I'm not sure what end result should be, but to fix the error you just need to escape the backslashes.
Since it's being eval
, you need to basically double-escape all backslashes:
eval("var b='{{!extract}}'; var s = b.replace(/\\n\\s*\\n/g, '\\n'); s;")
Upvotes: 2