I have a simple piece of script (which uses RegEx) which cleans up a source string to leave only alpha-numeric-and-whitespace characters.
Sometimes, I end up with a number of whitespace characters next to each other.
eg.
source: abc def ghi
result: abc def ghi
source: a*bc D*f
result: abc df
source: a*bc *** def
result: abc def <-- notice the two spaces in there
expected result: abc def <-- notice one space, here.
So i was hoping some regex could look for 2+ spaces next to each other, in some source string and replace it with a single whitespace character.
cheers 🙂
Just use
\s\s+as the string to match, and a single space as the replacement.