Post date: Oct 14, 2011 7:02:51 AM
A small example of how to use RegEx to replace something in a string ignoring their case.
function ReplaceString{ param([String]$str, [String]$oldValue, [String]$newValue) $value = [System.Text.RegularExpressions.Regex]::Replace($str, $oldValue, $newValue, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) $value}
Example of usage:
$spText = ReplaceString -str $storedProcedureText -oldValue "CREATE PROCEDURE" -newValue "ALTER PROCEDURE"