From: Caleb Clausen Date: 2006-08-03T06:44:42+09:00 Subject: Re: Building the finite state machine of a Ruby regexp On 8/1/06, Gilles Lacroix wrote: > > Does anyone know if there is a nice way to build the Finite State Machine > (FSM) of a Ruby regexp ? I don't know of anything specifically oriented to Ruby Regexps that does this, but surely such tools exist for (say) Perl...? > As an alternative solution, I wonder if someone knows about a module that > could parse Ruby regexps (accepting exactly the same regexp grammar as > Ruby) and let me read the associated FSM (or whatever graph-like structure > representing the regexp). Given how notoriously opaque they are, I've actually found regular expressions to be pretty easy to parse. I can send you a partial Regexp parser from one of my projects that just extracted the information I needed to know at the time.... but probably what you really want is Simon Strandgaard's regexp-engine. You can find it here: http://rubyforge.org/projects/aeditor/