I am trying to achieve this but it is working in Notepad++ but not in PowerShell+regex
File: 1.txt
1
2
3
4
PS:
(Get-Content E:\1.txt).replace("(?ms)1((?:.*\r?\n?)*)4", "success") | Set-Content E:\2.txt
I have tried with ?ms, ?s and ?m.
Any help?