Use regex replace in vscode find

Photo by Adi Goldstein on Unsplash

I needed to replace text that was a bit specific and to use vscode's regex replace but had to figure out the syntax. Just making a note here for myself so it's easy to lookup again!

If you're replacing text in a wrapped element you need to use groups and then replace the first item.

The example below will replace html comments with JSX code comment wrapping. Handy for converting raw tailwindui components to react components!

The vscode find popup

Here it is as code.

// for the find

// for the replace