[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108972] [Ruby master Bug#17120] String#start_with? return wrong result for Regexp patterns containing /\K/
From:
"mame (Yusuke Endoh)" <noreply@...>
Date:
2022-06-17 09:18:00 UTC
List:
ruby-core #108972
Issue #17120 has been updated by mame (Yusuke Endoh). Status changed from Open to Rejected `\K` changes the start position of the match string, but it does not change the match position itself. Actually, `"hello" =~ /h\Ke/` returns 0. (Note that `Regexp#=~` return the start position of the match.) ``` irb(main):001:0> "hello" =~ /h\Ke/ => 0 irb(main):002:0> $~.begin(0) => 1 ``` So I think this is by design. ---------------------------------------- Bug #17120: String#start_with? return wrong result for Regexp patterns containing /\K/ https://bugs.ruby-lang.org/issues/17120#change-98073 * Author: hanazuki (Kasumi Hanazuki) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.8.0dev (2020-08-13T01:14:20Z master 69b5241c36) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- `String#start_with?` unexpectedly reports true when the pattern Regexp contains `/\K/` (lookbehind) operator and the lookbehind pattern matches the beginning of `self`. ```ruby "hello".start_with?(/h\Ke/) # => true (unexpected) ``` In this example, `/h\Ke/` matches "hello", but it's not considered as a match at the beginning of the string by the other Regexp operations (e.g. `$~.begin(0) == 1`). -- 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>