From: merch-redmine@... Date: 2021-07-27T19:35:52+00:00 Subject: [ruby-core:104711] [Ruby master Bug#14500] Missing Regexp documentation and clarification on behavior of \K for edge case Issue #14500 has been updated by jeremyevans0 (Jeremy Evans). Sundeep (Sundeep Agarwal) wrote: > **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: > ``` The `\K` behavior at the end of a regexp is a bug that has already been filed upstream in Onigmo: https://github.com/k-takata/Onigmo/issues/152 I agree about the other documentation issues, and I'll push a commit shortly to address them. ---------------------------------------- Bug #14500: Missing Regexp documentation and clarification on behavior of \K for edge case https://bugs.ruby-lang.org/issues/14500#change-93037 * Author: Sundeep (Sundeep Agarwal) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- **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: