MediumText Processing
Extra Space Detector
Write a regex intended for use with .replace() to detect runs of two or more consecutive spaces in a string, so they could be collapsed down to a single space.
//
'hello world' / 'hello world' / 'a b' / 'single space here' / ' leading'
Test cases
- hello worldexpect match
- hello worldexpect no match
- a bexpect match
- single space hereexpect no match
- leadingexpect match
- notrailing expect match