[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106731] [Ruby master Bug#18415] String#rpartition is not sufficiently greedy compared to String#partition
From:
"sawa (Tsuyoshi Sawada)" <noreply@...>
Date:
2021-12-19 10:44:52 UTC
List:
ruby-core #106731
Issue #18415 has been updated by sawa (Tsuyoshi Sawada). I think the actual result is expected. It is `partition`'s responsibility to match the left-most position possible, and it is `+`'s responsibility to match as long as possible from that position. Likewise, it is `rpartition`'s responsibility to match the right-most position possible, and it is `+`'s responsibility to match as long as possible from that position. `["...99", "9", "..."]` is the correct result of this. If you want to match `999` with `rpartition`, you need to do something like: ```ruby "...999...".rpartition(/(?<!\d)\d+/) # => ["...", "999", "..."] ``` ---------------------------------------- Bug #18415: String#rpartition is not sufficiently greedy compared to String#partition https://bugs.ruby-lang.org/issues/18415#change-95415 * Author: jdashton (J Daniel Ashton) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.0preview1 (2021-11-09 master 5a3b2e6141) [x86_64-darwin21] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- ``` 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>