I have the following string:
var str = "something\n
// comment\n
somethingElse();\n
end();\n";
I have to remove from it the commend and everything below it. How can I do that? I tried:
str.replace(/(\/\/.*?end\(\);)/s, '');
But I am getting an error that the /s
flag is undefined. What's wrong?