Find characters between single quotes ‘
$string = "'LastName',  ([samaccountname])"
[Regex]::Matches($string, "(?<=\')(.*?)(?=\')").Value
Details
Uses a regex expression with find all characters that match the expression.

Example
PS C:\> $string = "'LastName',  ([samaccountname])"
>> [Regex]::Matches($string, "(?<=\')(.*?)(?=\')").Value

LastName
  |  
Find characters between Greater Than and Less Than signs
$string = "LastName,  ([samaccountname])"
[Regex]::Matches($string, '(?<=\<)(.*?)(?=\>)').Value
Details
Uses a regex expression with find all characters that match the expression.

Example
PS C:\> $string = "LastName,  ([samaccountname])"
>> [Regex]::Matches($string, '(?<=\<)(.*?)(?=\>)').Value

FirstName
  |  
Find characters between Brackets []
$string = "LastName, FirstName ([samaccountname])"
[Regex]::Matches($string, '(?<=\[)(.*?)(?=])').Value
Details
Uses a regex expression with find all characters that match the expression.

Example
PS C:\> $string = "LastName, FirstName ([samaccountname])"
>> [Regex]::Matches($string, '(?<=\[)(.*?)(?=])').Value

samaccountname
  |  
Find characters between Parentheses ()
$string = "LastName, FirstName ([samaccountname])"
[Regex]::Matches($string, '(?<=\()(.*?)(?=\))').Value
Details
Uses a regex expression with find all characters that match the expression.

Example
PS C:\> $string = "LastName, FirstName ([samaccountname])"
>> [Regex]::Matches($string, '(?<=\()(.*?)(?=\))').Value

[samaccountname]
  |  
Remove all special characters including spaces
$string = "1. Computer name:DC-G11-FTW.contoso.com"
[regex]::Replace($string,"[^0-9a-zA-Z]","")
Details
Uses a regex expression with replace to remove all characters that do not match the expression.

Example
PS C:\> $string = "1. Computer name:DC-G11-FTW.contoso.com"
>> [regex]::Replace($string,"[^0-9a-zA-Z]","")

1ComputernameDCG11FTWcontosocom
  |  |  
Remove all special characters leaving spaces
$string = "1. Computer name:DC-G11-FTW.contoso.com"
[regex]::Replace($string,"[^0-9a-zA-Z ]","")
Details
Uses a regex expression with replace to remove all characters that do not match the expression.

Example
PS C:\> $string = "1. Computer name:DC-G11-FTW.contoso.com"
>> [regex]::Replace($string,"[^0-9a-zA-Z ]","")

1 Computer nameDCG11FTWcontosocom
  |  |  
Replace using Regular Expression
$string = 'Thank you for calling 555-5757 your order total is $123.32'
$string -Replace "[0-9]","0"
Details
Use the -Replace to Replace String using a regular expression

Example
PS C:\> $string = 'Thank you for calling 555-5757 your order total is $123.32'
>> $string -Replace "[0-9]","0"

Thank you for calling 000-0000 your order total is $000.00
  |  |