Regular Expression Development Tools

Since ModSecurity is based on regular expressions, a lot of rule creation requires developing and testing regular expressions. Therefore I looked for a tool that can be used to test regular expressions for validity and accuracy before using the regular expression in a ModSecurity rule. I found two free tools that let you do that:

  • The Regex Coach is simple and powerful. You simply type your expression at the upper box and text to match at the bottom one and any matches, if found, are highlighted in the text. In between the boxes you can control the regular expression flags such as “ignore case” or “global match”. The Regex Coach does not stop there, it provides insight into the regular expression matching process but showing a tree view of the regular expression and letting you follow the matching process step by step.
  • Expresso - Unfortunately The Regex Coach chokes on the regular expressions we use in ModSecurity Core Rule Set. So I searched and found an alternative that works fine with our regular expression: Expresso. While free, it is not your typical open source software. Apart from using .NET framework, it politely asks for a (free) registration and generally seems to move away from free. It is also more complex and while very strong on peripheral features such as a library of regular expressions and saving your test work in a project file, it actually knows less about regular expressions. But it works with complex ones.

Comments are closed.