I have to replace the first character in a string. I have a snippet like this:
if(!([string]::Compare($filestmp.Substring(0,1), "M", $True)))
{
echo cos
$filestmp = $filestmp.Replace('^(.*?)M(.*)', 'Zmodyfikowany ')
}
The code doesn't throw any exceptions, and it doesn't work either. The if condition passes, since my echo statement is printed. What am I doing wrong here?
String.Replace()doesn't support regex, use the-replaceoperator orRegex.Replace()