I can't figure this out:
22.584\r\n\t\t\tl-6.579-22
I want to match the "\r\n\t\t\t" and replace with a single space " ". Problem is the number of "\t", "\r", and "\n" fluctuates, as do the surrounding characters.
Help!
I can't figure this out:
22.584\r\n\t\t\tl-6.579-22
I want to match the "\r\n\t\t\t" and replace with a single space " ". Problem is the number of "\t", "\r", and "\n" fluctuates, as do the surrounding characters.
Help!
#!/usr/bin/ruby1.8
s = "22.584\r\n\t\t\tl-6.579-22"
p s # => "22.584\r\n\t\t\tl-6.579-22"
p s.gsub(/[\r\n\t]+/, ' ') # => "22.584 l-6.579-22"
I'd treat the CR-NL as one atom:
str.gsub!(/(?:\r\n)+\t+/, ' ')