Processing regular expressions?

J

Jasen J.

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.
 
A

Ammar Ali

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
 
A

Ammar Ali

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top