Commit 431f474b authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #3497 from ksss/subreplace

\1 sequences as empty strings
parents ff262f21 b56ad8d1
......@@ -34,6 +34,8 @@ class String
m
when "'"
post
when "1", "2", "3", "4", "5", "6", "7", "8", "9"
""
else
self[j, 2]
end
......
......@@ -365,6 +365,7 @@ assert('String#gsub', '15.2.10.5.18') do
assert_equal('$$a$$', '##a##'.gsub('##'){|w| '$$' }, 'mruby/mruby#847 another case with block')
assert_equal('A', 'a'.gsub('a', 'A'))
assert_equal('A', 'a'.gsub('a'){|w| w.capitalize })
assert_equal("<a><><>", 'a'.gsub('a', '<\0><\1><\2>'))
end
assert('String#gsub with backslash') do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment