RegWizard: Regular Expression Live Powertoy
In today's post, I thought I'd toot my own horn. (well Matthew Kruskamp's and mine) It's about a powertoy that we worked on over the past quarter to allow for regular expression building to be much easier in development. The initial start of our project was based on how we saw a lot of tools out in the market today. For instance, RegexBuddy is a good example because it has some pretty amazing features and yet you do need to pay for a license. In our case, we wanted to create a similar product, complete with features, but with the user's intent in mind. To this I present our product. Enjoy!
Alright so starting off, we need to of course support the ability to actually type regular expressions. Aside from the ability to type regular expressions what about the abilty to actually validate it against a document. Regular Expression powertoys do this, so it's justified as such.
The nice thing about RegWizard is that we have built-in a sort of Autocompletion feature similar to what you would see in most IDEs such as Microsoft Visual Studio's Intellisense. The difference however is that, unlike most programming languages, there is no coupling to go off of for generating the view for a given context.
However, what we can do is break down how an expression is compiled. If you notice all those icons in the view, there actually is some context to what you are typing in the editor. For instance, if you were to type a left parenthese ( you would get a filter for any capture group. Or if you were to type a left brace you get a character class view. The same goes for all types of nodes.
The nice thing about being able to determine which type of expression we are dealing with, we can very easily interpret the entire expression and output a verbalized tree.
Taking notice on the verbalized form of our regular expression, you will notice the complete tree of each node. Once the expression in the editor has been validated, then the tree is then validated and rebuilt. Given the fact that all of the nodes are preloaded, building a tree is nearly instantaneous. There are of course expanded features we are looking to build such as the ability to maneuver nodes around, or even edit them from within the verbalized tree.
The way we get this information is through a simple XML file that defines all of our regular expression nodes. It's actually fairly simple. From the XML file we can obtain all the descriptions, node types, definitions, character vales (if they exist), and even icon for each node type.
Following this, all definitions are loaded from the XML file, and then used throughout the interpreting process.
RegexLibrary.xml and from this we simply validate it with an XSD schema.
We're moving towards a XSLT transformations later on to transform between regular expression language implementations, to account for the differences between languages such as Perl, XSLT... etc.
Moving on from definitions, we also have a section for your own regular expression library.
With this 'library' of yours, any regular expression that you type in the editor, you save and load at a later time. This of course, is stored in an XML file, similar to how our definitions are used in our regular expressions.
A nice aspect about RegWizard is that we've designed the interaction to be similar to most development environments. (Since this is a product targeted at developers.)
In our next release (3/17/07) we are looking to include the ability to move the environment around through docking and tabbing. There is of course other work and features, that we are putting into the application, but I'll have to leave it at that until a later post.
Check out our project on sourceforge: