Remove all console.log() using Regex in VSCode
Dec 21, 2019
If you’re using VSCode as your text editor, it’s easy to do this using Regex.
- Open the search option in the sidebar menu
- Type in console.log.*$ or console\.log\(.+?\);
- Select the Use Regex option found in the upper right corner of the search panel that’s designated by the icon .*
- Press Find All to find all instances of
console.log()
and then press Replace All or console\.log\(([^)]+)\); for multiple lines
That's all folks!