Have a cup of (regexp) Expresso

Hmm, long time without posts, ah? For some people, who’re regular readers here it may seem just the same situation as my latest post-crisis this August. Well – that’s not the case, I hope. This long posting gap was just because of “no time”, “no willingness” and similar lame excuses.

Now I have finally found something, which I would like to write about. Few days ago, while reading my latest CodeProject e-mail magazine, my attention was captured by a small tool, published there: Expresso regular-expression’s tool.

In my work (as a programmer), and also in my hobby (the programming) it happens sometimes that I need regexp searches and replaces. Each time when I have to do this stuff I am getting very upset, because:

* Although there are some regular expression’s “standards”, there is no real standard, which defines what regular expression syntax is and what it should contain. There are some “de-facto” standards (PCRE for example), but usually the big companies (such Microsoft) prefer to make their own.

* Sometimes the libraries, which I have(had) to use in the applications, are compatible with these “standards”, but some times they are not.

* I never had the chance (and the willingness too) to become an regexp expert, so each time I have to write a regexp I just start with a long pray, and eventually a slottering, if there are some goats around.

This is because until now I never had the chance to find a really good regexp debugger/tester, at which I just put my regular expression, and some sample text, and I see the results immediately. Few months ago I found something, which I thought will be the tool, but somehow I did not like it and I just had it for reference (when I go home, I will update this article to contain a link to that tool too, if I find a link there).

Well, today I am astonished! Expresso seems to be The One. It contains a bunch of features, which include:

* Detailed tree of your regular expression

* Regular expression builder (for the regexp lamers like me). This builder shows you the (most of the) possible regular expression contents and you may choose what your regexp to contain. No more searching in the net for some specific regexp junc, yeah!

* Detailed tree of what your regexp matches (you provide a sample text, on which the regexp match is performed) – a great regexp debugging feature!

* Nice regexp library – you can choose a bunch of library regexps, and you can learn from there. Of course, if you need to expand the library with your favorite regexps – it’s up to you.

* Code generator: the tool contains a nice code generator, which can give you directly the code, which will match your regular expression. Here is the place non-.NET guys to scream, but yes – the tool itself if .NET based and (I believe – temporarily) it generates only .NET code (Managed C++, C# and Visual Basic). You’ll say – that’s very easy job to do (generating the .NET code), but the most important thing is that it’s already there and you do not have to do it each time yourself, if you want to use your regexp in .NET code.

* Because the tool is .NET based, it has this great feature for .NET programmers – the ability to test how much time it will take on you machine to match your sample against current regular expression. You give the number of the iterations – it gives the result. Nice, if you want to know what’s the performance of your regexp (for example, 100K matches of my simple regexp [ ]*(test)[ ]*(.*) were made for about 3.01 seconds).

* …And more. I was browsing through the functionalities for not so long time, and I’m absolutely sure there are plenty of nice things I still haven’t seen.

The current disadvantages of the tool are:

* It’s available only on Windows. I suppose it’s .NET nature makes this mandatory for now. But maybe the author can take a look over Mono 🙂 ? The Portability is a great thing, isn’t it?

* It’s open, but copyrighted source code. But this is the author’s decision, and we have to respect it. I think it’s fair enough, having in mind that the tool is free to use. Yes, it has free of charge one time registration, but I think we also should respect the author’s right to know who’s using his tool. If you use it – you can take 10 seconds to send a mail to the author with your name and email – I think you will not regret it, because Expresso will save you much more time, if you’re writing regexps frequently.

What is my advice? Take the risk 🙂 – download, install, test and enjoy! I’m really interested if someone could test this tool on Linux with Mono. I’m not sure if Mono is ready enough to run this tool, but why not give it a shot? It would be great if it works there too.

Once again – many thanks, Jim Hollenhorst of Ultrapico. Keep the good work – I am sure many people appreciate it!
– – –
Dec 22nd Update: CodeProject recently published “The 30 Minute Regex Tutorial” – a .NET regular expressions tutorial. A great text to read, if you’re new to these expressions, and to Expresso as well.

2 thoughts on “Have a cup of (regexp) Expresso

  1. Аз на freshmeat намерих поне 8 проекта, които имат подобни функции на Еxpresso-то. Е, не генерират .NET код и не поддържат MS regex (wtf is that?), но са свободен софтуер. Ето някои от тях, виж дали няма да ти свършат работа.
    http://freshmeat.net/projects/visualregexp/
    http://freshmeat.net/projects/regex-coach/
    http://freshmeat.net/projects/regexper/
    http://freshmeat.net/projects/txt2regex/
    http://freshmeat.net/projects/rtest/

  2. Благодаря ти, Христо!
    Тези връзки ще свършат работа при нужда. Вече си харесах (още) един графичен туул – за жалост пак затворен сорс, но поне е “donateware” :).
    Всъщност – току-що открих, че сорса на Expresso е достъпен от материала в Code Project, така че ще оправя това по-горе…

Leave a Reply to Христо ЕрининCancel reply

Theme: Overlay by Kaira Extra Text