Blog

Wednesday, June 17, 2009
Eclipse Regular Expressions plugins

Whenever I need to use regular expressions in Java, I end up wasting time messing with them to get them to work. And because you have to write your regex as a String in Java, you have to escape all the backslashes. Pretty soon, it becomes really hard to read. What I would really like is a plugin that lets me test my regex dynamically.

Others have thought of this. So I installed a variety of them and tried them out.

First up, Eclipse Regular Expression Tester. Its update site is http://brosinski.com/regex/update After installing, it shows itself in the preferences as RegEx Tester. It provides a new view called RegEx Tester. After a little testing, it seems that it does its job. The view makes very inefficient use of screen real estate. The results of the "test" occupy too much vertical space.

I also did not like the way you have to configure regex parameters globally. When I'm doing regex stuff, it's different every time. I need to be able to tweak in a more immediate way.

Next is QuickREx. The update site is http://www.bastian-bergerhoff.com/eclipse/features

This one does a variety of flavors of regex (JDK, ORO, blah, blah, with Perl and awk varieties) fwiw. You can also keep the regex's and "test text" in a library.

This thing is even worse with screen real estate, but at least the options are available in the view so you don't have to go to the prefs to change them. There's also a dialog for constructing a regex by selecting components from dropdowns. This seems a little odd to me, since if you know the meanings of all the terms in the dropdowns, you almost certainly know a shitload about regex and you don't need this tool. Whatever.

Anyway, it's the winner so far, even though the "copy regex to Java String" button doesn't work.

On to Regex Util. Update site is http://regex-util.sourceforge.net/update/ This is all about Java-style regex's, so maybe less UI clutter? Anyway, this one has no prefs. The UI is nicely laid out: minimal. Options and flags are dropdowns, not a gazillion checkboxes. Unlike the others, this one does not show groups, but it does highlight the match as you select parts of the regex. This seems like a cool debugging tool. Besides, once can always go into "replace" mode and enter the requisite $1, $2 and so on.

And copying to a Java-style String works and the opposite function is available.

Yay! This one is the winner.

Labels: ,

0 comments

AddThis Feed Button

Twitter Updates

    follow me on Twitter

    Archives