I'm trying to wrap all console.log();
of my code with condicional if(showLog) { }
. I was learning regex and found that I was able to select all console.log()
expressions including those separated in several lines by eclipse formatting, however, I could not make the selected excerpt end in ;
, so that the start snippet of an expression console.log()
to the end of the code, which ended in ;
, was selected. Could someone tell me how to do the selected expression just go to the first ;
to find?
The expression I'm using is console[\s]*\.log\([\s\S]*(?!\))*\);
Unfortunately it's not possible for me to post all the code here, but I'll put below examples I've been testing:
console.log();
console.log("ok");
console.
log("ok");
console
.log("hey" +
"guys");