Collections:
Other Resources:
String Replacement in Windows PowerShell
How to replace a part of a string in Windows PowerShell?
✍: FYIcenter.com
You can use the "-Replace" operation to replace a part of a string in Windows PowerShell.
Here is the syntax of the "-Replace" operation:
$subject -Replace $pattern,$replacement
Regular expression is supported in $pattern.
Here are some good examples of string comparison operations:
PS C:\fyicenter> "You should eat ice cream" -Replace "ice cream","fruits" You should eat fruits PS C:\fyicenter> "Feb 14, 2016" -Replace "(\w+) (\d+), (\d+)",'$2-$1-$3' 14-Feb-2016
Note that captured groups in regular expression pattern match are used in the replacement expression. The single-quoted string literal is used to preventing immediate variable expansion.
⇒ String Object Methods in Windows PowerShell
⇐ String Comparison in Windows PowerShell
2016-10-19, ∼2626🔥, 0💬
Popular Posts:
UpdateUI.exe at startup ,how to remove it Actually, you should keep UpdaterUI.exe as a startup, beca...
What is the "Credential Manager (VaultSvc)" system service on Windows Server 2012? Can I disable "Cr...
What is the scheduled task "\Microsoft\Windows\Soft wareProtectionPlatform\S vcRestartTask"on my Wind...
What Is the VIDEO_TS Folder or Directory on a DVD-Video (Movie) Disc? On a DVD-Video disc, usually a...
What is the scheduled task "\G2MUpdateTask-S-1-5-21 -..."on my Windows 7 computer? "\G2MUpdateTask-S...