# Allow back reference with nest level in Oniguruma for Ruby a

**URL:** <https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164>\
**Category:** Ruby\
**Created:** [May 14, 2007, 10:21pm UTC](https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164 "2007-05-14T22:21:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wonado](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wonado](https://www.ruby-forum.com/u/wonado)\
**Post date:** [May 14, 2007, 10:21pm UTC](https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164/1 "2007-05-14T22:21:08Z")

</div>

Hello dear Ruby folks!

Nearly one year ago I asked K. Kosako for a new Oniguruma feature which  
will  
help to recognize plindrome sentences. It was an idea for an article  
series in  
Ruby-Mine, a german Ruby blog site, about pattern matching with Ruby  
using  
regular expressions.

K. Kosako built a special new element, which is described in the  
History…

* * *

2006/07/18: Version 4.2.0

## 2006/07/18: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/07/18: [new] (thanks Wolfgang Nadasi-Donner) add back reference with nest level. \k\<name+n\>, \k

…and in the Oniguruma description…

* * *

back reference with nest level

```
 \k<name+n> n: 0, 1, 2, ...
 \k<name-n> n: 0, 1, 2, ...
 \k'name+n' n: 0, 1, 2, ...
 \k'name-n' n: 0, 1, 2, ...

 Destinate relative nest level from back reference position.

 ex 1.

   /\A(?<a>|.|(?:(?<b>.)\g<a>\k<b+0>))\z/.match("reer")

 ex 2.

   r = Regexp.compile(<<' __REGEXP__'.strip, Regexp::EXTENDED)
   (?<element> \g<stag> \g<content>* \g<etag> ){0}
   (?<stag> < \g<name> \s* > ){0}
   (?<name> [a-zA-Z_:]+ ){0}
   (?<content> [^<&]+ (\g<element> | [^<&]+)* ){0}
   (?<etag> </ \k<name+1> >){0}
   \g<element>
   __REGEXP__

   p r.match('<foo>f<bar>bbb</bar>f</foo>').captures

```

* * *

This feature disapeared for Ruby later on…

* * *

2006/08/11: Version 4.2.3

## … 2006/08/07: [spec] move definition of USE\_BACKREF\_AT\_LEVEL into NOT\_RUBY.

!!!  
My question is now - WHY???

I would like to see it workable for Ruby again, it can be useful - and -  
it is  
already there!  
!!!

Wolfgang Nádasi-Donner

---

<div class="post-metadata">

**Author:** ![wonado](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wonado](https://www.ruby-forum.com/u/wonado)\
**Post date:** [May 15, 2007, 5:15pm UTC](https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164/2 "2007-05-15T17:15:19Z")

</div>

I have one question, because there is no reaction to this post:

Is this here (comp.lang.ruby) the right place for discussions and  
“change  
proposals” for Oniguruma usage in Ruby 1.9?

If this is not the case, please give me a hint where to place these  
texts.

Thanks in advance, Wolfgang Nádasi-Donner

---

<div class="post-metadata">

**Author:** ![wonado](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wonado](https://www.ruby-forum.com/u/wonado)\
**Post date:** [May 15, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164/3 "2007-05-15T17:20:20Z")

</div>

Hi,

In message “Re: [Minor Change Proposal]Allow back reference with nest  
level in Oniguruma for Ruby again”  
on Wed, 16 May 2007 00:15:04 +0900, Wolfgang Nádasi-Donner  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|Is this here (comp.lang.ruby) the right place for discussions and “change  
|proposals” for Oniguruma usage in Ruby 1.9?

ruby-core list is the better place.

```
          matz.

```

---

<div class="post-metadata">

**Author:** ![wonado](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wonado](https://www.ruby-forum.com/u/wonado)\
**Post date:** [May 15, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164/4 "2007-05-15T17:35:24Z")

</div>

Yukihiro M. schrieb:

> ruby-core list is the better place.
> 
> ```
> matz.
> 
> ```

I see - but how to place texts there? - Via “[http://www.ruby-forum.com/](http://www.ruby-forum.com/)”  
there  
is a read-only access only.

Wolfgang Nádasi-Donner

---

<div class="post-metadata">

**Author:** ![wonado](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wonado](https://www.ruby-forum.com/u/wonado)\
**Post date:** [May 15, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/allow-back-reference-with-nest-level-in-oniguruma-for-ruby-a/104164/5 "2007-05-15T18:00:58Z")

</div>

Yukihiro M. schrieb:

> ruby-core list is the better place.
> 
> ```
> matz.
> 
> ```

Thank you for the hint - I copied it there and close the question in  
comp.lang.ruby.
