Feature #1201: Add relative group reference in back reference with nest level in regular expressions (e.g. \k<-5+1>)
http://redmine.ruby-lang.org/issues/show/1201

Author: Wolfgang NĂ¡dasi-Donner
Status: Open, Priority: Normal
Category: core, Target version: 1.9.1

It should be possible to use relative group references in back reference with nest level.

Reason: As named in Ticket 1200 relative group references can be very helpful in writing subexpessions, which can be used later on as often as necessary in one regular expression.

Unfortunately back references with nest level, \k<n+level>, \k<n-level>, \k'n+level', and \k'n-level', do not allow relative group referencing, so they can only be used if one knows, how many normal groups are in the complete regular expression before the referenced group.

If there are relative group references possible, e.g.  \k<-n+level>, \k<-n-level>, \k'-n+level', and \k'-n-level', these constructs can be used in subexpressions designed to be used more than once in a regular expression.


----------------------------------------
http://redmine.ruby-lang.org