Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex: Match this string

Tags:

regex

ruby

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!

like image 676
neezer Avatar asked Oct 20 '25 21:10

neezer


1 Answers

s/\s+/ /g

s/(?:\\[rnt])+/ /g
like image 74
kennytm Avatar answered Oct 22 '25 11:10

kennytm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!