Skip to main content
added 68 characters in body
Source Link
Mathias R. Jessen
  • 178k
  • 13
  • 175
  • 234

You could remove everything up to and including the : with -replace, then let String.Trim()String.Trim() take care of the whitespace:

PS ~> $string = "Account name:            abc.def"
PS ~> ($string -replace '^.*?:').Trim()
abc.def

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

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
Source Link
Mathias R. Jessen
  • 178k
  • 13
  • 175
  • 234

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