Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
I used to hate regular expressions, however, recently I've had a need to use them a fair amount so actually started to appreciate them. What I found challenging then was debugging them. Writing code, compiling it and executing it just to find out the regex was incorrect was not going anywhere fast, so I looked around and found Reggy.app. This very simple app lets you put in your test strings and most importantly, your regex and see what matches. It's a super handy tool.
reggy.png


There are other tools out there for this kind of thing, but I find Reggy is just so simple and lightweight that it's become my regex debugging tool of choice.



Best of all, Reggy lets you see what is matching visually. The matches are highlighted for you so there is no second-guessing of what works and what doesn't.

So far I didn't really answer whether you should or should not regex, well that depends - it depends on whether regular expressions are really what your code requires, sometimes a simple string comparison is all that's needed. It's really up to you to decide, with great power [or regex], comes great responsibility :)

-i

Skip down to comments...
A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. If you spot something out of place, please do let me know.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...