Powershell Tip #110: Replace multiple spaces by one comma By powershellgu | August 14, 2016 0 Comment Tip: You can replace multiple spaces by one comma. This is an example with several random spaces, there are several possible ways to do that : PowerShell $test = '1 2 3 4 5' $test -replace ' {2,}', "," $test -replace '\s\s+', "," 123 $test = '1 2 3 4 5'$test -replace ' {2,}', ","$test -replace '\s\s+', ","