'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 <sduncan / wetafx.co.nz> 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
>
>