有没有一个优雅的一线做以下?
$myMatch = "^abc(.*)" $foo -match $myMatch $myVar = $matches[1]
我对$ myVar变量感兴趣…
只需使用-replace:
原文链接:https://www.f2er.com/regex/357352.html$foo = 'abcDEF' $myMatch = "^abc(.*)" $myVar = $foo -replace $myMatch,'$1' #$myVar contains DEF