Actions
Bug #11793
closedputs 'ab'.gsub('a', '\\+') - unexpected output
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
Description
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
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0