2
I’m trying to involve everyone console.log(); of my code with the condicional if(showLog) { }. I was learning regex and found I could select all the expressions console.log() including those separated in several lines by eclipse formatting, however, I could not make the selected section finish in ;, so that the beginning passage of an expression console.log() until the end of the code, which ended in ;, was selected. Someone would tell me how to make the selected expression only go to the first ; what to find?
The expression I’m wearing is console[\s]*\.log\([\s\S]*(?!\))*\);
Unfortunately it is not possible that I post all the code here, but I will put down examples in which I have been testing:
console.log();
console.log("ok");
console.
log("ok");
console
.log("hey" +
"guys");
Funny, in http://regexr.com/ it works, however in eclipse it does not find any corresponding excerpt
– Gabriel C.
@Gabrielc. I wonder if you have
tabs ? try to join\tthus:console[\s\t\n\.]+log\([^;]*\);– Sergio
Thank you so much! Now it’s working perfectly.
– Gabriel C.