From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 19B0C19E0056 for ; Wed, 9 Dec 2015 14:02:23 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 82D6AB5D918 for ; Wed, 9 Dec 2015 14:34:05 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 0D6F218CC7B8 for ; Wed, 9 Dec 2015 14:34:06 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 0855A1204B1; Wed, 9 Dec 2015 14:34:06 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 635F4120031 for ; Wed, 9 Dec 2015 14:34:02 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=LIT6+2lamwlBp+6d2+YsrF/WURE=; b=pJ6IcqJAKsFrkY6K8L VlgqHxsESOAf+VN13XwerpVCIpsxespz72AcbkAadQYxZKbx3nzpM3pcVEPrJFmb ZyXsf98NHLmKVPvNg89xOc+QlqC8Y/PjrqmWO4UDTQsEd/EtHrtr3SmH3o2KWZTo bb9/zIPC8pzJpE2rSBYKubIX8= Received: by filter0417p1mdw1.sendgrid.net with SMTP id filter0417p1mdw1.28463.5667BD4631 2015-12-09 05:33:58.518472895 +0000 UTC Received: from herokuapp.com (ec2-54-196-144-109.compute-1.amazonaws.com [54.196.144.109]) by ismtpd0005p1iad1.sendgrid.net (SG) with ESMTP id Gwmu_JkcSZuf2CKkBI2OVQ for ; Wed, 09 Dec 2015 05:33:58.924 +0000 (UTC) Date: Wed, 09 Dec 2015 05:33:58 +0000 From: william.burnson@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 46681 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11793 X-Redmine-Issue-Author: burnson X-Redmine-Sender: burnson X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6bWL1Z8+xNfFWdg6fetxIL5SAa5fKFPMrNpi BPvcEwruWuTN6eClsflG4O5kCAYbgK/Yvneb1RBnW1xJoY5Ge2RQ6X4FFaFuyBjSV/9vdLKINh9UpB ptfFrB8yb05kzJ/eePJtjrNSGFmfM4Ep/mBisTWNL8nB4uNF7fZQEu+BTg== X-ML-Name: ruby-core X-Mail-Count: 71979 Subject: [ruby-core:71979] [Ruby trunk - Bug #11793] puts 'ab'.gsub('a', '\\+') - unexpected output X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11793 has been updated by William Burnson. Description updated ---------------------------------------- Bug #11793: puts 'ab'.gsub('a', '\\+') - unexpected output https://bugs.ruby-lang.org/issues/11793#change-55387 * Author: William Burnson * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Test case: puts 'ab'.gsub('a', '\\\\+') Expected output: \\+b Actual output: b The way I understand gsub(pattern, replacement) when used with two string arguments is that it will perform a literal replacement, so it is quite unexpected that substituting with \+ removes the pattern entirely. Doc: http://ruby-doc.org/core-2.2.3/String.html#method-i-gsub -- https://bugs.ruby-lang.org/