From: salamond Date: 2013-02-27T18:41:06+09:00 Subject: Re: ruby split not working properly --485b397dd69784f31804d6b19212 Content-Type: text/plain; charset=ISO-8859-1 'foo\bar'.split('\') this one doesn't even starts running in irb. since irb would consider this \' as an escaping single quote, it's gonna wait for another single quote to end this string variable. On Wed, Feb 27, 2013 at 12:35 PM, Sam Duncan wrote: > On 02/27/2013 05:24 PM, Scott Macri wrote: > >> I'm trying to run the following command in irb on a mac: >> >> something.split('\') >> >> This doesn't work either: >> something.split("\") >> >> However, this just causes irb not return a result and prevents irb from >> being useable and I have to close it. >> >> Any thoughts as to why this is happening? Is this a ruby bug? >> >> It only seems to happen with the \ only..... This is a serious problem >> because I am attempting to parse the results of a Linux command which >> contains many \'s. I have the exact same issue with: >> something.delete('\') >> >> Please help.... Thanks. >> >> 1.9.3p125 :001 > 'foo\bar'.split('\\') > => ["foo", "bar"] > > Something like that? > > Sam > > --485b397dd69784f31804d6b19212 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
'foo\bar'.split('\')

this one doesn't even starts running in irb.
since = irb would consider this \' as an escaping single quote,
it's gonna wait for another single quote to end this string variable.




On Wed, Feb 27, 2013 at 12:35 PM, Sa= m Duncan <sduncan@wetafx.co.nz> wrote:
On 0= 2/27/2013 05:24 PM, Scott Macri wrote:
I'm trying to run the following command in irb on a mac:

something.split('\')

This doesn't work either:
something.split("\")

However, this just causes irb not return a result and prevents irb from
being useable and I have to close it.

Any thoughts as to why this is happening? =A0Is this a ruby bug?

It only seems to happen with the \ only..... =A0This is a serious problem because I am attempting to parse the results of a Linux command which
contains many \'s. =A0I have the exact same issue with:
something.delete('\')

Please help.... Thanks.

1.9.3p125 :001 > 'foo\bar'.split('\\')
=A0=3D> ["foo", "bar"]

Something like that?

Sam


--485b397dd69784f31804d6b19212--