Anybody who's read my Visual Studio tips knows I'm something of a tools junkie, tools being a favorite subject...
to which I return again and again. A recent Web prowl led me to this non-pareil (and I'm not talking about a chocolate candy with sprinkles, either—go ahead, look it up): Roy Osherove's Regulator. Regulator is a free regular-expression testing and learning tool. It lets you create the regular expression of your choice, then test it with inputs to see what kind of output it produces. It's extremely handy to have around any time you're writing code that includes regular expressions, so you can test and tweak it to your heart's content before coding it up in final form, and be reasonably sure it's fairly well-tested and working the way you want it to beforehand.
If you visit Osherove's Screen Shots page, you'll get a pretty darn good idea of what Regulator can do. Although it's a little more complicated, it reminds me of another favorite tool of mine, HTML-Kit (which has nothing to do with VS.NET, but is one heck of a great HTML hacking tool), and offers the same kind of menu-driven syntax charts to help you figure out what you want to do (and often, how you need to do it). If you scroll down to the second example on that page, you'll see how entering a parenthesis in an expression line automatically triggers an expression menu you can select from, and helps drive its syntactically correct statement with short, symbolic argument examples.
For those not already in the know, a regular expression—a "regex" in programmer-speak—is a compact and complex notation used to instruct computer programs how they should search and identify patterns that occur in input text, along with some action to take when a pattern match occurs. The Unix utility grep (short for "general regular expression parser") is a prototypical and still powerful tool based on regexes, and many other programming environments make liberal use of such notations and related capabilities.
Whether you're already in the know or not, I guarantee you'll find the Regulator to be a useful addition to your box of programming or coding tools, especially when you need to process input streams on a regular basis. And, as if the capabilities already described weren't enough, this program also permits you to search the terrific library of existing regular expressions at RegexLib, and submit your own creations for enshrinement there as well. The tool will even provide performance results so you can tweak your expression handling notation to make it as efficient as possible. It even supports a toolbar that can supply frequently-used text strings (called "snippets") that you can use as-is, or customize to include your own favorites.
What a peach this tool is. I can't say enough good things about, nor will you feel otherwise, if you download it and try it for yourself.
Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. E-mail Ed at email@example.com with comments, questions, or suggested topics or tools to review.