Find characters between Parentheses ()
$string = "LastName, FirstName ([samaccountname])" [Regex]::Matches($string, '(?
Combine an array into a string with semicolon separator
$array = 'The','quick','brown','fox','jumps','over','the','lazy','dog.' $array -join(';')
Combine an array into a string with space separator
$array = 'The','quick','brown','fox','jumps','over','the','lazy','dog.' $array -join(' ')
Split string into an array on spaces
$string = "The quick brown fox jumps over the lazy dog." $string.split()
Exclude blanks when splitting a string into an array
$option = [System.StringSplitOptions]::RemoveEmptyEntries $string.split(";",$option)
Get all Text after a character
$string = "1. Computer name:DC-G11-FTW.contoso.com" $string.Substring($string.IndexOf(":")+1,$string.length-$string.IndexOf(":")-1)
Get all Text before a character
$string = "[email protected]" $string.Substring(0,$string.IndexOf("@"))
Remove all special characters including spaces
$string = "1. Computer name:DC-G11-FTW.contoso.com" [regex]::Replace($string,"[^0-9a-zA-Z]","")