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, ∼2830🔥, 0💬
Popular Posts:
Can I remove startup application "atiptaxx.exe - ATI Desktop Control Panel" to speedup my computer a...
What is "SMS Agent Host" in my Windows 7 service list? And how is "SMS Agent Host" service related t...
How to select your wireless connection during the Windows 7 system initial set up process? If you bo...
Can I remove startup application "ssdiag.exe - Diagnostic Traces Sonic Shared Driver Component" to s...
What is "Protexis Licensing V2" in my Windows 7 service list? And how is "Protexis Licensing V2" ser...