Subject: [Tools-discuss] ABNF to Regular Expression Tool

From: "Thomson, Martin" <[email-masked]>
Date: Thu, 26 Mar 2009 19:05:57 -0500

Hi Folks,

Continuing the theme on ABNF... As something of a game, I've developed a tool that is able to take a grammar represented by ABNF and convert it to a regular expression.

There is only minimal optimization of the regex that it produces, but it is able to produce a complete regex for the big ones: RFC 3986, RFC 5322 (the regex for a complete mail message was probably too large to be useful, ~40k!).  It struggles where the grammar recurses, falling back to '.*', but aside from that it seems accurate.  

When it comes down to it, it's not that useful, but it was a pleasant distraction.

I have put source up on github under the name abnf2regex:

  <http://github.com/martinthomson/abnf2regex/tree/master>

Cheers,
Martin
------------------------------------------------------------------------------------------------
This message is for the designated recipient only and may
contain privileged, proprietary, or otherwise private information.  
If you have received it in error, please notify the sender
immediately and delete the original.  Any unauthorized use of
this email is prohibited.
------------------------------------------------------------------------------------------------
[mf2]