Permalink
Browse files

\1 sequences as empty strings

  • Loading branch information...
ksss committed Mar 10, 2017
1 parent c6e5659 commit b56ad8d1223c5419bde4338692d111eaa39444c2
Showing with 3 additions and 0 deletions.
  1. +2 −0 mrblib/string.rb
  2. +1 −0 test/t/string.rb
View
@@ -34,6 +34,8 @@ def __sub_replace(pre, m, post)
m
when "'"
post
when "1", "2", "3", "4", "5", "6", "7", "8", "9"
""
else
self[j, 2]
end
View
@@ -365,6 +365,7 @@ def to_str
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

0 comments on commit b56ad8d

Please sign in to comment.