summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 01f3f03d15..6343a2af5f 100644
--- a/string.c
+++ b/string.c
@@ -2579,7 +2579,7 @@ rb_str_scan(str, pat)
match = rb_backref_get();
rb_match_busy(match);
rb_yield(result);
- rb_backref_set(match);
+ rb_backref_set(match); /* restore $~ value */
}
rb_backref_set(match);
return str;