I am wondering if there is a better way to escape regex characters in powershell, I know C# has Regex.Escape, but I'm not sure if powershell has its own method...
This is what I am doing at the moment:
$escapedStr = $regexStr -replace "+","+" -replace "[","[" -replace "]","]" -replace "(","(" -replace ")",")"
Question&Answers:os