Search and replace is a key part of most text editors, and it’s generally very simple to use: type a keyword, press [Enter] to look for it, then step through however many matches there might be. This is so straightforward and familiar that it’s easy to forget there’s any other way.
Regular expressions do offer a far more powerful alternative, though, at least if you take the time to learn how they work. As an example, take a look at \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b : despite looking like binary garbage, this is actually a very useful search term which will locate any email address. Not something you could easily do in any other way.
Most text editors don’t support regular expressions, of course, not least because they can be horribly complicated. But if you’d like to give them a try, you might be interested in grepWin, a stand-alone tool which makes it (relatively) easy to search and replace across multiple plain text files.
The program doesn’t force you to tackle regex complexities immediately. At its most basic, you can just choose a folder to search (or right-click it in Explorer and select grepWin), enter the text to match, and click Search. Any hits will be quickly displayed in the "Search results" box, ready for inspection.
GrepWin’s "Limit Search" pane includes many tools to help refine your search further. You’re able to search by file name (*.txt|test*.xml) and size; to include system, hidden or binary files; to include subfolders, or exclude whatever folders you like.
Using grepWin as a search and replace tool is straightforward, too. Enter the old text in the "Search for" box, the new version in "Replace with", click "Replace" and leave the program to do its work.
The real power and flexibility of grepWin does come in its support for regular expressions, though, which gives you an enormous amount of control over the search process. Try the example above: point the program at your User folder, enter \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b in the "Search for" box, select "Regex search" and click "Search". You should find it pulls up every plain text file containing an email address. And if that seems useful, clicking "Add to Presets" will save the expression for very easy recall later.
This all worked well for us, but if you need some help with regular expressions, the grepWin site has a very brief tutorial to get you started. It may seem baffling initially, but persevere, run plenty of test searches with grepWin and you’ll soon begin to figure things out. Although, beware: once you learn what regular expressions can do, you’ll never be satisfied with ordinary keyword searches again.