From: Gavin Sinclair Date: 2015-10-10T10:37:15+11:00 Subject: [ruby-core:71036] Bug? Trying to get backslashes into a string using sub or gsub --001a11c263d8db47320521b47683 Content-Type: text/plain; charset=UTF-8 I'm trying to emit two backslashes in a string (for a newline in LaTeX) and it's proving very difficult. Is the behaviour shown below a bug? irb(main):054:0> '\\\\'.bytes == [92,92] => true irb(main):056:0> "NL".sub('NL', '\\\\').bytes == [92,92] => false Thanks, Gavin --001a11c263d8db47320521b47683 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'm trying to emit two backslashes in a string (f= or a newline in LaTeX) and it's proving very difficult.

<= /div>
Is the behaviour shown below a bug?

irb(main):054:0> '\\\\'.bytes =3D=3D [92,92]
=3D> = true
irb(main):056:0> "NL".sub('NL', '\\= \\').bytes =3D=3D [92,92]
=3D> false
<= br>
Thanks,
Gavin
--001a11c263d8db47320521b47683--