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, ∼3021🔥, 0💬
Popular Posts:
How to install FireFTP? FireFTP is a Mozilla FireFox 2 add-on that provides FTP client functions on ...
How much memory can I free up by disabling unnecessary Windows services? If you are buying a new com...
What is PIM? What is a PIM Item, What is PIM Item Transfer? What is PIM? PIM stands for Personal Inf...
What is the startup program "QuickSet MFC Application - quickset.exe" on my Windows 8 computer? Can ...
How to use "query user" to find out who is logged in to my Windows 7 computer? If you allow remote l...