Home > Blockchain >  Powershell string filtering
Powershell string filtering

Time:09-22

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 :/

CodePudding user response:

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#",""}
  • Related