Graphrex 0.5: Import/export regular expressions via the clipboard, better graphics, and more

Graphrex 0.5 introduces tools to help you import and export regular expressions to Java code. It also has improved graphics to make diagrams clearer and more responsive to users, and other enhancements.

Regular expressions can now be imported and exported via new Paste As and Copy As actions. The new Paste As wizard takes a regular expression in Java String format that is already on the clipboard (i.e. that you have copied from your code) and applies a series of transforms that convert it into the simple regular expression format, for example by removing escape characters, so that you can paste the result directly into Graphrex for testing or visualization.

Here is a simple example:

"^\\.|^\\@" → ^\.|^\@

Transforms have removed the quotes around the string, and have un-escaped the ‘\’ character. There are other transforms as well — see the Help text.

The Copy As wizard reverses the process: you can copy your regular expression from Graphrex into the clipboard while transforming it into the required Java String format, then you can paste it into your source code editor.

Editing of complex regular expressions is a little easier in Graphrex 0.5 because the regular expression text editor (in the Regex View) has been enhanced with bracket matching. This works pretty much as the similar function does in the Eclipse Java source code editor.

In this version the graphics have also been improved. The diagram adjusts more automatically when you open and close combo boxes. This allows you to open a character set and inspect its contents without having the expanded node be over-written by adjacent nodes. We have also reduced the need for scroll bars within parts of the diagram, so they will appear much less often. As before, you can always use the Arrange action to re-draw a diagram and make it neater. Finally several small bugs that caused drawing errors have been fixed.

Bug Fixes

  • A warning occurred when the user had closed the Regex View and then switched to a new Graphrex editor
  • An internal error exception was being thrown in some regular expressions that contained an escaped meta-character.
  • Capture groups that had no content in a match were not being cleared of content from any previously-selected match.
  • Graphrex’s Regex View appeared not only when the focus was gained by a Graphrex editor (which is by design) but also by other editors as well.
  • Infinite loops could occur in the graphics code because of a thread synchronization issue.
  • Bugs that caused various errors in the Graphrex diagram were fixed.