More fun with regular expressions

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})*$)|(^$)/

Advertisement

Leave a Comment

Filed under ColdFusion, ExtJS, Javascript, Regular Expressions

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s