Alistair Trout
Alistair Trout

Reputation: 55

Powershell string filtering

I run a cmdlet in powershell which returns a string eg;

123@#EXT#outlook.com
[email protected]
[email protected]

I'm looking for a way to remove the #EXT# characters from the string. I can do everything but remove this and am struggling to find any documentation :/

Upvotes: 0

Views: 56

Answers (1)

pelin72
pelin72

Reputation: 93

Lets assume the cmdlet outputs an array of strings. This is simulated by the $adr variable.

#Array of strings
$adr = @(
    "123@#EXT#outlook.com"
    "[email protected]"
    "[email protected]"
)

$adr|foreach {$_ -replace "#EXT#",""}

Upvotes: 1

Related Questions