You could remove everything up to and including the `:` with `-replace`, then let String.Trim() take care of the whitespace: PS ~> $string = "Account name: abc.def" PS ~> ($string -replace '^.*?:').Trim() abc.def