aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--string.c1
-rw-r--r--test/ruby/test_string.rb2
-rw-r--r--version.h2
3 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index 15f8f718f5..80749c22a0 100644
--- a/string.c
+++ b/string.c
@@ -8950,6 +8950,7 @@ scan_once(VALUE str, VALUE pat, long *start, int set_backref_str)
else {
match = rb_backref_get();
regs = RMATCH_REGS(match);
+ pos = BEG(0);
end = END(0);
}
if (pos == end) {
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index f91ec297e0..c37191bda9 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1537,6 +1537,8 @@ CODE
assert_nil($~)
assert_equal(3, S("hello hello hello").scan("hello".taint).count(&:tainted?))
+
+ assert_equal(%w[1 2 3], S("a1 a2 a3").scan(/a\K./))
end
def test_size
diff --git a/version.h b/version.h
index a24f2128dc..19f8a4c8bd 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.5.2"
#define RUBY_RELEASE_DATE "2018-08-12"
-#define RUBY_PATCHLEVEL 67
+#define RUBY_PATCHLEVEL 68
#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 8