I need to be able to edit a text file, find strings such as "2022.09.20" (including the "") and replace them with "20220920". I think I am missing something this is what I tried
$sf = '.\TestCSV.csv'
$regex = '("\d{4}).(\d{1,2}).(\d{1,2})"'
$regex2 = '("\d{4})(\d{1,2})(\d{1,2})"'
(Get-Content $sf) |
Foreach-Object {$_ -replace $regex , $regex2 } | Set-Content '.\TestCSVNew.csv'
Any help much appreciated