Just a very quick post (more like a note to self) but I wanted to split a string with the $ sign in PowerShell:

powershell Download
'one$two$three$four$five' -split '$'

Took me a little while to realize that this doesn’t work as the split operator in Windows PowerShell uses a regular expression in the delimiter, rather than a simple character.

The easy fix is to Escape the $ sign with a backslash:

powershell Download
'one$two$three$four$five' -split '\$'

Or alternatively use the SimpleMatch option:

powershell Download
'one$two$three$four$five' -split '$', 0, "SimpleMatch"

The 0 represents the “return all” value of the Max-substrings parameter. You can use options, such as SimpleMatch, only when the Max-substrings value is specified.