\1 sequences as empty strings

This commit is contained in:
ksss
2017-03-10 22:22:06 +09:00
parent c6e5659fec
commit b56ad8d122
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -34,6 +34,8 @@ class String
m
when "'"
post
when "1", "2", "3", "4", "5", "6", "7", "8", "9"
""
else
self[j, 2]
end
+1
View File
@@ -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