From: Ammar Ali Date: 2010-10-16T01:41:53+09:00 Subject: Re: Processing regular expressions? On Fri, Oct 15, 2010 at 6:07 PM, Jasen J. wrote: > I'm interested in manipulating & munging regular expressions, not the > matches, but the regexes themselves. > > Specifically, I want to parse out the groups/captures in a regex much > like .named_captures and .names, but for ALL captures, not just the > named ones. > > My end goal is to take a regex like /(one)(two)(three)four/ and split it > up into three separate regexs > /(one)twothreefour/ > /one(two)threefour/ > /onetwo(three)four/ > > Any pointers would be appreciated. > > - Jasen. I haven't found anything like that yet. Would love to hear about any such tools. I recently did a couple of experiments that might be of interest of you. It is basically a preprocessor that expands repetitions and adds "aliases". The code and a brief description are at: http://github.com/ammar/meta_re Based on those experiments and some valuable feedback and ideas I received from others, I started work on a standalone regular expression parser. It is still in an very early stage, but might be of interest to you as well. That project repo is at: http://github.com/ammar/regexp_parser I would be interested in any comments you might have about either. Regards, Ammar