new--Replace Text in String
PowerShell has a replace method and a -replace operator.
-replace Operator
The -replace operator, like the -match operator uses regular expressions (Regex) to find the part of the string to replace. That means that the Regex operators will interpret special characters that might be found in a password as a Regex operator rather than as a literal character.
.replace Method
CODE
PS > "Hello World".Replace("World", "PowerShell")
Hello PowerShell
![](../__attachments/1984266471/image-20220608-171035.png?inst-v=a33ad75e-8fc6-41aa-a53e-3a49a14fd4b2)