I am parsing logs and grabbing output, but I want to clean up the out put. currently I am getting the full path of the log file in the output which is long and not needed. The code below is what I am trying to use, but I am getting an error that my replace is not a valid regular expression.
select-string $_ -pattern "gam.exe : Error 409: Entity already exists" -context 1,0 | ForEach-Object{$_ -replace "D:\test1\user\mail\mail-Load\logs","" }
I am not sure what I need to do to get the input for replace right, do I need to escape characters?