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{/$0/}
Hi! I'm Darragh ORiordan.
I live and work in Sydney, Australia building and supporting happy teams that create high quality software for the web.
I also make tools for busy developers! Do you have a new M1 Mac to setup? Have you ever spent a week getting your dev environment just right?
My Universal DevShell tooling will save you 30+ hours of configuring your Windows or Mac dev environment with all the best, modern shell and dev tools.
If you have a custom types file (e.g. myTypes.d.ts) but you get no errors from the type checker and compiler in typescript even though you know there are issues in the file you might have skipLibCheck turned on.
I regularly code on both MacOS and Windows machines and I was always annoyed how different the default experiences are on each. I need to use the same tools and the same experience on both.
Windows “WSL” (Windows Subsystem for Linux) is a great tool for this you can use on Windows 10 and newer. The latest version lets you run a full Ubuntu instance that integrates seamlessly with the underlying windows instance.
By using WSL2 you can have a (mostly) identical developer experience jumping between MacOS and Windows.
Better tooling for Developers
Many of the terminal tools that come with unix environments are functionally similar to how they were 20 years ago. But other developer tooling has advanced quite a bit since then.
You can replace tools like ls or cat with modern equivalents that support full colour, unicode icons, git state and more. Terminal prompts can be made git aware and use colour to indicate state so you don’t have to query git so often.
Keeping developer experience consistent across machines
Keeping any shell changes you make on one machine up to date on all the machines you code on is a nightmare without the right tooling.
This article also explains all the tools I use and how I keep the same terminal setup consistent on MacOS and Windows!