I have silently added a Software tab in this site, which will contain all the applications that I want to release for free to the public. I am still deciding if I'm going to include the source code. I'll probably will, but for now only binaries will be there.
The first application is the RegexCompiler. This is a powerful tool that makes it easy to build common regular expression into .Net assemblies. Such assemblies can be used to organize and distribute commonly used regular expressions; in some cases, it even improves performance of execution of regular expressions.
This application was built for a very regex intensive application, and I wanted to have such expressions interchangeable using DLLs for my application. In some cases, if the expression is to big, it improves the performance of the regular expression, but this is not always the case.
This is an example of the final usage of the Compiled Expressions:
C#:
SelectPattern pattern = new SelectPattern();
bool isMatch = pattern.IsMatch("\"select * from table1\"");
Patterns are stored in an xml file with extension *.recproj. The application provides an example which is:
XML:
<?xml version="1.0" encoding="utf-8"?>
<recproject name="Structum.Patterns.Data">
<assemblyfilename>Structum.Patterns.Data</assemblyfilename>
<namespace>Structum.Patterns.Data</namespace>
<regex name="SelectPattern">(?ism)\"[ \t]?.*select\b(?-ism)</regex>
<regex name="InsertPattern">(?ism)\"[ \t]?.*insert\b(?-ism)</regex>
<regex name="DeletePattern">(?ism)\"[ \t]?.*delete\b(?-ism)</regex>
<regex name="UpdatePattern">(?ism)\"[ \t]?.*update\b(?-ism)</regex>
</recproject>
The whole file represents an assembly and it is identified by the 'assemblyfilename'.
Each 'regex' tag contains the name of the Class and the actual Regular Expression. In the case of the Select Pattern:
XML:
<regex name="SelectPattern">(?ism)\"[ \t]?.*select\b(?-ism)</regex>
Which is looking for expressions of the form: "select * from table". It was used to identify select statements in code.
Also, this is my first application with C++/CLI. I'm a hardcore C++ fan, and I wanted to try the CLI version. While building the application, I was trying to have a more .Net mindset than C++, so that I could really learn the language. I have to say it was a really cool experience. It has been extremely useful for me, I hope it is also helpful for everybody else.
You can download RegEx Compiler in here.
A sample project can be found here.











