From: zn@...
Date: 2018-02-24T01:30:10+00:00
Subject: [ruby-core:85785] [Ruby trunk Misc#14500] Missing Regexp documentation and clarification on behavior of \K for edge case
Issue #14500 has been updated by znz (Kazuhiro NISHIYAMA).
Sundeep (Sundeep Agarwal) wrote:
> * suggestion to add that numbered capturing groups is limited to `9`
I don't think so.
Why did you think so?
```
irb -r irb/completion --simple-prompt
>> /()()()()()()()()()(a)/ =~ "a"
=> 0
>> $10
=> "a"
```
----------------------------------------
Misc #14500: Missing Regexp documentation and clarification on behavior of \K for edge case
https://bugs.ruby-lang.org/issues/14500#change-70631
* Author: Sundeep (Sundeep Agarwal)
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
**Capturing** section (https://ruby-doc.org/core-2.5.0/Regexp.html#class-Regexp-label-Capturing)
* formatting issue: `nth`
* suggestion to add a note on `\0` similar to the note mentioned in **Special global variables** (https://ruby-doc.org/core-2.5.0/Regexp.html#class-Regexp-label-Special+global+variables) section about `$&`
* suggestion to add that numbered capturing groups is limited to `9`
**Anchors** section (https://ruby-doc.org/core-2.5.0/Regexp.html#class-Regexp-label-Anchors)
* suggestion to add documentation on `\K`
* need clarification if the below behavior seen is expected and mention it while adding documentation
```
$ echo 'aaa' | ruby -pe 'gsub(/a\K/, ":")'
a:aa:
$ # what I expected
$ echo 'aaa' | ruby -pe 'gsub(/(a)/, "\\1:")'
a:a:a:
```
--
https://bugs.ruby-lang.org/
Unsubscribe: