I have a string like this:
i got sooome screeeewy inpuuuuut
I need to normalize it and beside other processing, I need to remove all repeated chars,
i.e. soooome becomes some and so on.
Grammar correctness does not matter.
You do not need regex for this. Simply use str.squeeze:
str = 'i got sooome screeeewy inpuuuuut'
=> "i got sooome screeeewy inpuuuuut"
str.squeeze
=> "i got some screwy input"
See live demo here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With