N
Nathaniel Madura
I am getting a string that has escape sequences in it, and I would like
to print it to the screen after reprocessing the escape sequences. Maybe
I have missed something obvious but I haven't seen anything in the docs
that suggest how to do this. To replicate the behaviour I create a
string in irb like so:
$ irbsome \n\r string \t with \r escape \n sequences
=> nilsome \n\r string \t with \r escape \n sequences
=> nil
I recognize that I can simply do a gsub:
some
\r string \t with \r escape
sequences
=> nil
but that would mean I would have to pattern match all sequences, and it
seems like there should be a better way
Any suggestions?
to print it to the screen after reprocessing the escape sequences. Maybe
I have missed something obvious but I haven't seen anything in the docs
that suggest how to do this. To replicate the behaviour I create a
string in irb like so:
$ irbsome \n\r string \t with \r escape \n sequences
=> nilsome \n\r string \t with \r escape \n sequences
=> nil
I recognize that I can simply do a gsub:
some
\r string \t with \r escape
sequences
=> nil
but that would mean I would have to pattern match all sequences, and it
seems like there should be a better way
Any suggestions?