Project

General

Profile

Actions

Bug #9849

closed

gsub(String, String) doesn't work properly

Added by shugo (Shugo Maeda) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.2.0dev (2014-05-19 trunk 46010) [i686-linux]
[ruby-core:62669]

Description

gsub(String, String) doesn't work properly as follows:

$ ruby -ve 'puts "あああ\"foo\"\n\"bar\"".gsub("\"", "\"\"")' 
ruby 2.2.0dev (2014-05-19 trunk 46010) [i686-linux]
あああ""foo"
"bar""

The expected behavior is:

$ ~/.rbenv/versions/2.1.1/bin/ruby -ve 'puts "あああ\"foo\"\n\"bar\"".gsub("\"", "\"\"")' 
ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
あああ""foo""
""bar""

It seems that the bug was introduced by r45451, so I assign this issue to nobu.

Actions

Also available in: Atom PDF

Like0
Like0Like0