I'm looking for a way to edit a bunch of files for an old website, specifically to remove a long JavaScript function that spans multiple lines. I need to declare a doctype before the HTML tag and handle a few other tweaks across about 150 pages. I have Windows grep, which is great for single-line replacements, but it doesn't handle multiline cases. Ideally, I want a user-friendly interface where I can copy and paste the text I need to change, and have it replaced across all the files in a folder without diving into regex. Any suggestions?
3 Answers
Visual Studio Code can handle multiline find and replace with regex fairly easily. But I get it, if you don’t want to mess with regex, it might not be ideal. Just wanted to throw it out there!
If you’re okay with Notepad++, it does require some regex understanding, but it has a GUI to make it easier. You'd need to deal with `n` for new line characters, but once you get the hang of it, it should work fine for multiline cases.
Notepad++ is a great choice! Just update it to the latest version, then hit Ctrl+H to open the replace dialog. You can use n or rn as line breaks between your search terms. It can find and replace across all files which should help you a lot.

Yeah, I hear you. Regex can be a pain, especially when it involves tweaking and debugging. Sometimes it feels like it's just as tedious as doing it by hand!