Last week a client asked me to help create a regular expression for parsing some numerical
data. I spent
about an hour on it and got the expression to very close to what was needed, by not
quite (OK, I admit
there is no such thing as very close or almost right when it comes
to regular expressions ? either I get it
or I don?t ? but don?t tell me that when I am struggling to get this to work).
Luckily, Stuart
Halloway gave Neal
Ford and myself a ride to the NFJS event
at Cincinnati yesterday
morning. When I got into the car and asked ?how are you doing?,? Stu started with
?Fine, Venkat, I am
thinking about JavaScript this morning.? (AJAX is in the air...) You can imagine how
the next forty minutes
from the airport to the symposium location went by.
Our conversation went from one thing to next (AJAX, Ruby, Rails, .NET, Java, dynamic
typing, unit testing,
software management), and finally to an obvious topic ? regular expressions, when
I asked Neal ?I have been
struggling with this regular expression. Do you know of a tool that will help me verify
what I build without having
to run my code??
You see, Neal gives talks on regular expressions and usually gets
into the plumbing of things. If I had given
him the text, he would have read out the regular expression right there. But, that
would not help me when I
get back to work on Monday (unless I take Neal with me, of course).
He asked me to look at Expresso.
[Written in .NET ? it has features to create C# and VB.NET code, but I did
not try those features. I needed help in fine turning my regular expression] So, I
downloaded and played
with it this morning.
It is sweet. Using this tool, it took me only a few minutes to figure out what I was
missing in my regular expression!
I tried out my expression, copied and pasted my expression into my code, ran my unit
tests that were written to verify
if I got (or would ever get) the expression right and got a nice encouraging green
bar for the first time. That one pesk
test that was failing finally passed.
If you ever need to use regular expressions, give Expresso a try. If you find not
much to do this Friday evening,
download, and take it for a ride?
Thanks Neal for helping me on this project. And Stu, I am still recovering from you
reading out that long command line
with grep, cut, xarg, pipe, ... at dinner last night.