Understanding complex regular expressions in Graphrex 0.3

Version 0.3 of Graphrex makes it easier to see which parts of your regular expression correspond to elements in the visualization of that expression. Now selecting a diagram element  highlights the corresponding part of your regular expression.

As an example of this new function, consider the following regular expression to recognize IPV4 addresses. It is a slightly simplified version of a post to StackOverflow, and the original was all on one line:

(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)

The screenshot below shows this same regex in Graphrex with its visualization. Notice how selecting one of the character sets in the diagram not only selects it in the outline view but now also highlights the corresponding span in the regex. This helps to find the specific occurrence of this element in all three views. (Click on the diagram to see the full-size version).

Selection screenshot

Graphrex 0.3 can select the parts of your regular expression that represent character sets, groups, quantifiers (like * or +), boundary markers — in fact the part of your regular expression that corresponds to any diagram element. This makes Graphrex an even more powerful tool for probing the structure of your regexes.

In version 3 we have also fixed a number of bugs and laid the foundations for more function in the future. We postponed the introduction of some other new features to get this one released as soon as possible.

About Alan

Alan does development at Croton Research.
This entry posted in Graphrex, News. Bookmark the permalink. 

Comments are closed.