Powershell - Strip spaces using regular expressions Jan 17, 2014 You can either match or replace string using inline regular expressions. Here’s how to do it in powershell: ([regex]"\W").Replace("hello worlD 123","") helloworlD123