DEV Community

Discussion on: Remove all console.log()s using Regex in Atom

Collapse
 
connectety profile image
Connectety • Edited

Hey great post :D
The regex you wrote might match other things than "console.log" like "console logs", I suggest escaping the dot (console\.log).
If you want do a little more (;|^)\s*console\.log\(.*?\)($|;) makes sure it's either at the start of a line or behind a semicolon (same with the end)

You could also use this package which does that and the logging part for you:
github.com/vishysank/console-log-atom

Collapse
 
michael profile image
Michael Lee 🍕

Thanks Allen! Didn't know this package existed. Will look into it!