フォルダ内のすべてのスクリプトファイルのテキストを置き換えたいのですが、次のPSコードを使用しようとしています。
$pattern = '(FROM [a-zA-Z0-9_.]{1,100})(?<replacement_place>[a-zA-Z0-9_.]{1,7})'
Get-ChildItem -Path 'D:\Scripts' -Recurse -Include *.sql | ForEach-Object { (Get-Content $_.fullname) -replace $pattern, 'replace text' | Set-Content $_.fullname }
しかし、表現の最初の部分を保持し、2番目の部分を置き換える方法がわかりません。どうすればこれを行うことができますか?ありがとう。