My Buddy, Regex

I generally don't subscribe to the UNIX religion, but there is one area where I am an unabashed convert: regular expressions. Yeah, the syntax is a little scary, but for processing strings, nothing is more effective. The RegEx is the power drill of the programmer's toolkit: not appropriate for every job, but the go-to tool for a lot of common jobs. And what could be more common than the humble string, particularly in this day and age of HTML, XML, SOAP, and other plain text formats? Most modern development languages have complete Regular Expression support-- even in the IDE for things like search and replace.


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2004/07/my-buddy-regex.html

I also found this crazy tool written in LISP (!)

http://www.weitz.de/regex-coach/

Which can actually step through a regex interactively-- an actual debug mode-- and display the parse tree. Very interesting and definitely unique…

It ain’t free anymore! $29.99…

The regulator on the other hand looks like a great free alternative.

There’s now also the very swish, free, JavaScript-powered RegexPal (cutely similar name, hmm?) at http://regexpal.com/ .

My RegEx Tool of choice is Rad Software Regular Expression Designer, which is free and works well, at least for my needs:
http://www.radsoftware.com.au/regexdesigner/

Nothing beats RegexBuddy. I pay for it (personally) as well. I’ve tried all the freebies, and they cannot compare. It’s honestly not much money (about $40), and it will save you oodles and oodles of time. Just think, if you’re time is worth ~$40/hr (as mine is thanks to my dilbert-esque corporate job), then you can pay for this in just one hour. Even if it takes 8 hours of your time to pay for this (which would be $5.00 per hour for 8 hours), it’s worth it!

Do yourself 2 favors. #1, learn regular expressions. #2, buy RegexBuddy.

Regards

Superb article, with fantastic references to resources. I’ve always used regular expressions sparingly, simply because I have to wrap my head around the syntax each time… but you have in a single post linked to a really concise set of great resources.

Have you considered, like, I dunno… just learning the language?

It’s not that hard.

Have you considered, like, I dunno… just learning the language?
It’s not that hard.

This is a crazy statement!

Sure the RegEx concepts of matching are not hard to understand. The problem is the human usability of the syntax is one of the worst I have ever encountered in all of software development.

If RegEx were designed today it would have fancy features like keywords instead of overloading the ‘?’ character to have 7 different meanings.

1 Like

For javascript regex testing, I use this online one - very easy to use and all.

http://www.pagecolumn.com/tool/regtest.htm

I am in the process of learning Perl and also Java. RegEx’s are perhaps one of the most important, and also complex aspects of these languages in order to extract information from input data and produce the desired output. Someone suggested just learning the language. I fully agree, but I feel that getting a tool like RegexBuddy would actually help me to learn Regex more rapidly than struggling through many books, websites, etc. I am going to buy the thing. For $40 I think it is worth it.