DEV Community

Discussion on: Remove all console.log() from your project in less than a minute

Collapse
 
suhailkakar profile image
Suhail Kakar

Thanks @ayc0
For multiline you need to use console\.log\(([^)]+)\);

Collapse
 
rishabh_sharma_ profile image
Rishabh Sharma

this is helpful

Collapse
 
mdadil09 profile image
Md Adil

it only selected the console.log which are commented not uncommented ones

Collapse
 
ayc0 profile image
Ayc0

It still won't work for code snippet like those:

console.log(
  'hello',
   world(1)
)
Enter fullscreen mode Exit fullscreen mode

(As it contains a closing parenthesis)

Thread Thread
 
wimdenherder profile image
wimdenherder • Edited

console\.log\((.|\n)*?\);?

It matches anything until it encounters ) again, with an optional whitespace and ;