I have a string:
"hello\t World\nbla"
I would like to split it to:
["hello\t ",
"World\n",
"bla"]
How would I do this in Ruby?
I have a string:
"hello\t World\nbla"
I would like to split it to:
["hello\t ",
"World\n",
"bla"]
How would I do this in Ruby?
Hopefully this helps..
>> "hello\t World\nbla".scan(/\w+\s*/)
=> ["hello\t ", "World\n", "bla"]
>> "hello\t World\nbla".scan /\S+\s*/
=> ["hello\t ", "World\n", "bla"]