2009.12.01...9:32 pm

More fun with regular expressions

Jump to Comments

I ( like many programmers I know) get just a little befuddled when trying to use regular expressions.  Over the years I’ve used numerous online RE parsers to test code.   Recently  I found a small RE parser that I absolutely love called “The Regex Coach”.

This little gem of a program  is great.  (As a bonus it is  free for both commercial and non-commercial uses.) Unlike other RE testers that I’ve used over the years, this one lets you actually step thru the parsing sequence and also see the execution tree of the RE.  These are very handy.  I find I am able to get to a functional RE statement in about a 1/4 the time as before.   You can get “The Regex Coach” from here.  http://weitz.de/regex-coach/

As a little bonus… here is a little gem of an RE statement (for field validation) for a field that must contain no value or one or more three digit numbers separated by commas.
(^(\d{3})(\,\d{3})*$)|(^$)

so in JavaScript the RE literal would be
/(^(\d{3})(\,\d{3})*$)|(^$)/

Leave a Reply