I want to use a regex that looks for spaces with a minimum length of 2 in a row, and replaces the occurrence with another value for each occurrence of the space found.
For example:
I love to eat cake
There are 3 spaces after love and 4 spaces after eat. I want my regex to replace occurrences of a space more than 1, and to replace it with a value for each occurrence found.
The output I am trying to go for:
I love---to eat----cake
I tried something like
myStr.replace(/ +{2,}/g, '-')