* [ruby-core:99553] [Ruby master Bug#17113] /\K/ in separator for String#split behaves differently than /(?<=)/
@ 2020-08-11 9:59 kasumi
2020-08-11 10:03 ` [ruby-core:99554] " kasumi
0 siblings, 1 reply; 2+ messages in thread
From: kasumi @ 2020-08-11 9:59 UTC (permalink / raw)
To: ruby-core
Issue #17113 has been reported by hanazuki (Kasumi Hanazuki).
----------------------------------------
Bug #17113: /\K/ in separator for String#split behaves differently than /(?<=)/
https://bugs.ruby-lang.org/issues/17113
* Author: hanazuki (Kasumi Hanazuki)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.8.0dev (2020-08-11T07:51:07Z master 5af983af4f) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When a String is `#split`ted with a pattern containing /\K/ (lookbehind) operator,
the portion that matches the lookbehind pattern will not appear in the result.
```ruby
"abcd".split(/b\Kc/) # => ["a", "d"]
"abcd".split(/(?<=b)c/) # => ["ab", "d"] -- expected result
```
In this example, since `/b\Kc/` matches `"c"` in `"abcd"`, the result is expected to be `["ab", "d"]`. Actually `["a", "d"]` is returned.
`(?<=)` operator seems to work expectedly.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ruby-core:99554] [Ruby master Bug#17113] /\K/ in separator for String#split behaves differently than /(?<=)/
2020-08-11 9:59 [ruby-core:99553] [Ruby master Bug#17113] /\K/ in separator for String#split behaves differently than /(?<=)/ kasumi
@ 2020-08-11 10:03 ` kasumi
0 siblings, 0 replies; 2+ messages in thread
From: kasumi @ 2020-08-11 10:03 UTC (permalink / raw)
To: ruby-core
Issue #17113 has been updated by hanazuki (Kasumi Hanazuki).
Patch: https://github.com/ruby/ruby/pull/3407
----------------------------------------
Bug #17113: /\K/ in separator for String#split behaves differently than /(?<=)/
https://bugs.ruby-lang.org/issues/17113#change-87015
* Author: hanazuki (Kasumi Hanazuki)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.8.0dev (2020-08-11T07:51:07Z master 5af983af4f) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When a String is `#split`ted with a pattern containing /\K/ (lookbehind) operator,
the portion that matches the lookbehind pattern will not appear in the result.
```ruby
"abcd".split(/b\Kc/) # => ["a", "d"]
"abcd".split(/(?<=b)c/) # => ["ab", "d"] -- expected result
```
In this example, since `/b\Kc/` matches `"c"` in `"abcd"`, the result is expected to be `["ab", "d"]`. Actually `["a", "d"]` is returned.
`(?<=)` operator seems to work expectedly.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-11 10:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 9:59 [ruby-core:99553] [Ruby master Bug#17113] /\K/ in separator for String#split behaves differently than /(?<=)/ kasumi
2020-08-11 10:03 ` [ruby-core:99554] " kasumi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).