I am searching for following regex pattern in a file "[a-zA-Z0-9]+[^"]+[a-zA-Z0-9]+" This pattern contains all text including spaces. I am trying to Replace spaces(\s) to underscore(_) for all the entries in file that matches above pattern
(Get-Content .\temp.log -raw) -replace '("[a-zA-Z0-9]+[^"]+[a-zA-Z0-9]+")', {$($1.replace(' ','_'))}
Let me know what i am missing here.
'a' -replace '(a)',('$1' -replace 'a','b')