I cant figure this out. Powershell running in PowerGUI
I have names that can be like either below stored in a variable $a
SMITH, JOHN A.
or
SMITH, JOHN
This almost works: $Reverse=(New-ObjectRegEx'[^\,]+','RightToLeft').Matches($a)-join'
'
but the output has the leading space after the comma and before the first name and appears like this when I write-host $Reverse
JOHN A. SMITH
JOHN SMITH
How can I change it so it does not include the space at the beginning?
JOHN A. SMITH
JOHN SMITH
Thanks!