PowerShell Split String by Whitespaces or Multiple Spaces Using Regex

Tuesday, October 7, 2025
This is a repost from my old blog. First posted in 10/25/2018.

I was looking into a way to split string that can take regular expression in PowerShell. Surprisingly, they have the capability:

$StringArray = $StringInput -split '\s+'