From: "nobu (Nobuyoshi Nakada)" Date: 2013-03-31T06:35:20+09:00 Subject: [ruby-core:53847] [ruby-trunk - Bug #8136][Closed] gsub strange behavior when substituting "\\'" Issue #8136 has been updated by nobu (Nobuyoshi Nakada). Category set to doc Status changed from Open to Closed This is one of most frequently asked questions. Though I can't remember a pointer to good explanation, someone would know it. ---------------------------------------- Bug #8136: gsub strange behavior when substituting "\\'" https://bugs.ruby-lang.org/issues/8136#change-38059 Author: alexeymuranov (Alexey Muranov) Status: Closed Priority: Normal Assignee: Category: doc Target version: ruby -v: 2.0.0 =begin s = "\\'" # => "\\'" print s # \' "foo".gsub("f", s) # => "oooo" Can anybody please explain to me why it works like this? Is this a bug? =end -- http://bugs.ruby-lang.org/