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, ∼2620🔥, 0💬
Popular Posts:
What is yt.dll - DLL File - Yahoo Toolbar for IE Browser? yt.dll is installed as part of the Yahoo! ...
How to disable Problem Reports and Solutions? Problem Reports and Solutions is a nice feature of Win...
How much does Windows Media Player 11 cost Windows Media Player 11 is a free update to the Windows M...
What is pdf.ocx - ActiveX - Adobe Acrobat Control Version 6.0 for ActiveX? ActiveX pdf.ocx is instal...
What is "McAfee Security Scan Component Host Service" in my Windows 7 service list? And how is "McAf...