News for hackers. Stuff that matters.
Re:A human way to define regular expressions in Ruby by krainboltgreene on Thursday September 05, 2013 @05:38PM (#6337241)
Ouch, thanks for the harsh words.

But yes, 1.2 will likely have named captures and back refs. It's a regex, so $1 etc come with turning it into a regex and doing matching.

Re:A human way to define regular expressions in Ruby by lelf on Thursday September 05, 2013 @05:50PM (#6337324)
OK then. But look at state of the art solutions I mentioned ;-)

Perl5's R::Grammars is doing it the same way you do — it generates one-big-scary regex. But this lib is nowhere close to what it can do.

For idea: it will provide fully parsed struct like {proto: 'http', domain: { all: 'www.exampe.com', subdomains: ['www','example'], tld: 'ord', ... }

Re:A human way to define regular expressions in Ruby by krainboltgreene on Thursday September 05, 2013 @05:56PM (#6337373)
You can do this with regex captures.
Re:A human way to define regular expressions in Ruby by lelf on Thursday September 05, 2013 @06:15PM (#6337463)
It's not $1="this", $2="that", it's a tree.

So, no, you cannot. And there're many more cool things you cannot