Project

General

Profile

This project is closed and read-only.

Actions

Bug #1443

closed

String#gsub handles backslashes incorrectly

Bug #1443: String#gsub handles backslashes incorrectly

Added by notshawn (shawn landen) over 17 years ago. Updated almost 15 years ago.

Status:
Rejected
Assignee:
-
[ruby-core:23389]

Description

=begin
@shyouhei (Shyouhei Urabe) Urabe

I didn't see how to comment on the bug so i hid to file a new one
This is a continuation of bug #1441

The backslashes are being doubled under single quotes and double quotes, but String#gsub requires you to quadruple (4x) them, 4 backslashes for every one in the resultant string.

printf "b".gsub("b","\\")

prints a single backslash(), while it should print 2(\). (as printf "\\"; does)

The reason it looks different is because String#inspect shows strings as escaped.
=end

Actions

Also available in: PDF Atom