| Views: 1800
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.
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 :)
Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip
Other posts you may like...