在 PowerShell 文档中,它在哪里谈到使用特殊变量 $1、$2 等来表示-replace正则表达式中的捕获?
'asdf' -replace '(a)(\w{3})', '$2$1';
# Result: sdfa
它似乎没有出现在about_Comparison_Operators我期望的地方,以及-replace操作员。我也进去看了about_Regular_Expressions,里面没有。
我确实在这篇博文中找到了一个示例,但似乎在官方文档中找不到任何内容。
http://windows-powershell-scripts.blogspot.com/2009/06/regular-expressions-in-powershell.html