Regex Guru

Thursday, 19 December 2013

Compare and Convert Regular Expressions Between Different Applications

Filed under: The Guru's Kitchen — Jan Goyvaerts @ 5:06

The big change in RegexBuddy 4, released this September, is that RegexBuddy now emulates the regex flavors that it supports far more accurately. While RegexBuddy 3 did a pretty good job of telling you which syntax each flavor supported, RegexBuddy 4 also knows exactly how each feature works in each regex flavor. Even fundamental tokens like the dot behave differently in different applications (the dot doesn’t match line breaks in most applications and there’s quite some variety in which characters are considered line breaks).

RegexBuddy 4 now differentiates between many different versions of the regex flavors that it supports. Where RegexBuddy 3 had only “Java”, RegexBuddy 4 knows the differences between Java 4, 5, 6, and 7. All in all RegexBuddy 4.0 supports 126 different applications if you count all the versions and variations separately.

This new attention to detail made two new features possible: regex flavor comparison and regex flavor conversion. On the Create panel, you can now select additional applications. RegexBuddy will analyze your regex for all these applications at the same time. The regex tree will point out all of the differences, or tell you that there are no differences. This is a great feature if you’re writing a regex that will be used in a shared library that needs to work with multiple versions of a programming language. It’s also great for learning a new regex flavor by comparing regexes you created before between the flavor you know and the flavor you’re learning. You can compare any regex between any and all of the flavors supported by RegexBuddy.

If you want to use a regex that was created for a different application, or if you want to port a regex to a new version of your application or programming language, convert it on RegexBuddy’s new Convert panel. RegexBuddy automatically substitutes equivalent syntax and warns you about any subtle differences in behavior in the two applications that affect your regex. Because RegexBuddy tells you what to expect, you can test the converted regex in a far more deliberate manner. Differences in which characters are seen as line breaks by the dot, for example, won’t show up when testing the regex unless you provide sample text with varying line break styles.

RegexBuddy’s website has just been updated to provide some more details about these two features along with a couple of screen shots:

No Comments

No comments yet.

Sorry, the comment form is closed at this time.