Remove all console.log() using Regex in VSCode

David Garcia
Dec 21, 2019

If you’re using VSCode as your text editor, it’s easy to do this using Regex.

  1. Open the search option in the sidebar menu
  2. Type in console.log.*$ or console\.log\(.+?\);
  3. Select the Use Regex option found in the upper right corner of the search panel that’s designated by the icon .*
  4. 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!

--

--