Powershell, replace DOT with SPACE

Question:

This works:

Output: This string has a lot of commas in it.

But this doesn’t work:

Output: blank.

Why?

Answer:

-replace searches using regular expressions (regexp), and in regexps the dot is a special character. Escape it using ‘\‘, and it should work. See Get-Help about_Regular_Expressions.

Source:

Powershell, replace DOT with SPACE by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply