From: "nagachika (Tomoyuki Chikanaga)" Date: 2022-03-12T07:55:55+00:00 Subject: [ruby-core:107857] [Ruby master Bug#18415] String#rpartition is not sufficiently greedy compared to String#partition Issue #18415 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE ruby_3_0 4b1cee1431b44e923611c65a8ec5cc61d4025641 merged revision(s) e2ec97c4b823a0b2e0c31e7a6d77b1dcdc0dfada. ---------------------------------------- Bug #18415: String#rpartition is not sufficiently greedy compared to String#partition https://bugs.ruby-lang.org/issues/18415#change-96796 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * ruby -v: ruby 3.1.0preview1 (2021-11-09 master 5a3b2e6141) [x86_64-darwin21] * Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE ---------------------------------------- ``` ruby 3.1.0-preview1 :043 > "...999...".partition /\d+/ => ["...", "999", "..."] 3.1.0-preview1 :044 > "...999...".rpartition /\d+/ => ["...99", "9", "..."] ``` Using the regex /\d+/, `partition` gives you all consecutive digits. However, `rpartition` gives only the last digit. -- https://bugs.ruby-lang.org/ Unsubscribe: