Regular Expressions are a -replace’s best friend

Are you familiar with PowerShell’s -replace operator? "John Jones" -replace "Jones","Smith" Most folks are aware of it, and rely on it for straightforward string replacements like this one. But not very many people know that -replace also does some amazing stuff using regular expressions. "," -replace "\.\d{2}\.","10" That’d change the input string to “,,” replacing all occurrences of two digits, between periods, to 10. The 12 would be skipped because it isn’t followed by a period, as specified in the pattern. Note that all occurrences are replaced, in keeping with the usual operation of -replace. The operator can also do capturing […]