From: "Jesús Gabriel y Galán" Date: 2012-02-17T04:43:37+09:00 Subject: Re: Any parser *for* regular expressions? On Thu, Feb 16, 2012 at 6:53 PM, Brian Candler wrote: > Is there some existing code (preferably ruby) which can take a regular > expression and > build a parse tree from it? e.g. I want to turn > > "^(foo|(bar|baz)*|qux)$" > > into something like this: > >     >    /  |  \ >  |   >     >   /   |   \ > foo   <*>   qux >       | >     >     /   \ >   bar   baz > > or some equivalent representation of the regular expression itself. > > (The trouble is, when you google for 'ruby regular expression parser' > you get all sorts of parsers written *using* regular expressions, not > parsers *for* regular expressions!) I don't have a good answer for your problem, but this question reminded me of an old rubyquiz I have fond memories of :) http://www.rubyquiz.com/quiz143.html Jesus.