From: XrXr@... Date: 2019-08-10T04:12:49+00:00 Subject: [ruby-core:94241] [Ruby master Bug#16091] gsub Issue #16091 has been updated by alanwu (Alan Wu). `gsub(pattern, replacement)` always interprets `replacement` as a regex replacement directive. You can use the block form to substitute verbatimly: ```ruby a = "test ?" b = "?" c = "\\&" a.gsub(b) { c } #=> "test \\&" ``` ---------------------------------------- Bug #16091: gsub https://bugs.ruby-lang.org/issues/16091#change-80548 * Author: thiaguerd (thiago feitosa) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ```ruby a = "test ?" b = "?" c = "\\&" a.gsub(b,c) ``` -- https://bugs.ruby-lang.org/ Unsubscribe: