如何在 powershell 的 sed 中反向引用捕获组?我似乎找不到它的语法。
我希望 IEecho "hello" | sed "s|(h)ello|world\1|"
输出worldh
,但却收到以下错误:
sed : sed.exe: -e expression #1, char 18: invalid reference \1 on `s' command's RHS
At line:1 char:16
+ echo "hello" | sed "s|(h)ello|world\1|"
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (sed.exe: -e exp...' command's RHS:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError