Project

General

Profile

Actions

Bug #14707

closed

String#scan(/\K/) has changed its behavior in ruby 2.5

Added by knu (Akinori MUSHA) about 6 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p59 (2018-03-31 revision 63049) [x86_64-darwin17]
[ruby-core:86663]

Description

It seems \K does not work as expected any more:

% ruby -ve 'p "a1 a2 a3".scan(/a\K./)'

ruby 2.3.7p456 (2018-03-28 revision 63014) [x86_64-darwin17]
["1", "2", "3"]

ruby 2.4.5p297 (2018-03-29 revision 63036) [x86_64-darwin17]
["1", "2", "3"]

ruby 2.5.1p59 (2018-03-31 revision 63049) [x86_64-darwin17]
["a1", "a2", "a3"]

I'm not sure if this is intended, but at least there is no mention for this in the NEWS file.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0