Find characters between single quotes ‘
$string = "'LastName', ([samaccountname])" [Regex]::Matches($string, "(?
Find characters between Greater Than and Less Than signs
$string = "LastName, ([samaccountname])" [Regex]::Matches($string, '(?
Find characters between Brackets []
$string = "LastName, FirstName ([samaccountname])" [Regex]::Matches($string, '(?
Find characters between Parentheses ()
$string = "LastName, FirstName ([samaccountname])" [Regex]::Matches($string, '(?
Remove all special characters including spaces
$string = "1. Computer name:DC-G11-FTW.contoso.com" [regex]::Replace($string,"[^0-9a-zA-Z]","")
Remove all special characters leaving spaces
$string = "1. Computer name:DC-G11-FTW.contoso.com" [regex]::Replace($string,"[^0-9a-zA-Z ]","")
Replace using Regular Expression
$string = 'Thank you for calling 555-5757 your order total is $123.32' $string -Replace "[0-9]","0"