How to replace dates in text file with Powershell using regular expressions
I've done much searching on this and haven't worked out the answer, but I feel like I am close!

I have dates in a text file in the following format: `06/18/2012 23:00:43 (dd/mm/yyyy HH:MM:SS)` which I want to convert to: `2012-18-06 23:00:43 (yyyy-dd-mm HH:MM:SS)` using Powershell.

To perform the conversion in a text editor using regular expressions I would do this: 

    Find: ([0-9]+)/+([0-9]+)/+([0-9]+)

    Replace with: \3-\2-\1

So I have tried using this same logic in a the following Powershell script:

    (Get-Content C:\script\test.txt) | 
    Foreach-Object {$_ -replace "([0-9]+)/+([0-9]+)/+([0-9]+)", "(\3-\2-\1)"} | 
    Set-Content C:\script\test.txt

but that results in the following undesired change:

> \3-\2-\1 23:00:43

Can anybody help me nail this?

Many thanks in advance!
How to replace dates in text file with Powershell using regular expressions
===

I've done much searching on this and haven't worked out the answer, but I feel like I am close!

I have dates in a text file in the following format: `06/18/2012 23:00:43 (dd/mm/yyyy HH:MM:SS)` which I want to convert to: `2012-18-06 23:00:43 (yyyy-dd-mm HH:MM:SS)` using Powershell.

To perform the conversion in a text editor using regular expressions I would do this: 

    Find: ([0-9]+)/+([0-9]+)/+([0-9]+)

    Replace with: \3-\2-\1

So I have tried using this same logic in a the following Powershell script:

    (Get-Content C:\script\test.txt) | 
    Foreach-Object {$_ -replace "([0-9]+)/+([0-9]+)/+([0-9]+)", "(\3-\2-\1)"} | 
    Set-Content C:\script\test.txt

but that results in the following undesired change:

> \3-\2-\1 23:00:43

Can anybody help me nail this?

Many thanks in advance!