DEV Community

Discussion on: 1 line of code: How to replace multiple spaces with one space

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

So I have always used

/\s+/
Enter fullscreen mode Exit fullscreen mode

It's good to know the escape character for whitespace \s or tabs \t

I think it would be perfect of only 2 or more where matched {2,} something like that