Software: The Regulator 2.0 Regex Tester

Regular expressions (aka regex). If you are already scratching your head, then maybe this pick isn’t for you…but then again, maybe it is. Regular expressions are a way to describe how to search for text–and optionally to do a replacement or several. They can be daunting at first, but once you practice a bit you’ll start to wonder how you got along without it.

One of the shortcomings of regular expressions is that they can be a little difficult to get exactly the result you want. For example:

^\(*\d{3}\)*( |-)*\d{3}( |-)*\d{4}$

Could be used to validate a phone number. You see that, right? No? Well…that’s where it’s very helpful to have a tool on your computer to help you work out the search pattern to find exactly what you want–especially when you are learning. A tool like The Regulator 2.0.

The Regulator is a Windows program whose sole purpose is for people to test and learn and use regular expressions. I can’t begin to tell you how many times it has save my bacon when I needed to find and modify a string in a large block of text and the search/replace options in editors came up wanting–even ones that handle some regex. Yes, there are times when there is no substitute for hacking a Perl script to get the job done, but often all you really need is one or two go-rounds with The Regulator.

The program has many options that can be employed by the advanced regex practitioner, but it’s not so laden that the newcomer can’t get serious work done as well. There is an area for your input text which won’t get changed as you experiment. There is an area for your regex, and a box for the results found by the search pattern as well as a tab with the changed text. Often, that’s all you need. If you need more, there’s more. I leave it as an exercise for the user to peruse the program and help file to discover some really nifty tools.

If you have ever been frustrated that an editor’s search/replace wasn’t powerful enough to let you get your work done, I can’t recommend The Regulator strongly enough. It should be a staple for all but the most basic computer installations.

The Regulator is available for download at sourceforge.

(Small little workaround if the program ever hangs at startup: Deleting or renaming the settings.config file will most likely fix this.)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.