From: "Wolfgang Nádasi-Donner" Date: 2007-05-15T05:20:08+09:00 Subject: [Minor Change Proposal]Allow back reference with nest level in Oniguruma for Ruby again 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, \k ----------------------------------------------------------------- ...and in the Oniguruma description... ----------------------------------------------------------------- back reference with nest level \k n: 0, 1, 2, ... \k 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(?|.|(?:(?.)\g\k))\z/.match("reer") ex 2. r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED) (? \g \g* \g ){0} (? < \g \s* > ){0} (? [a-zA-Z_:]+ ){0} (? [^<&]+ (\g | [^<&]+)* ){0} (? >){0} \g __REGEXP__ p r.match('fbbbf').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