當試圖在此Exchange命令上應用以下正則表達式時出現以下錯誤。Powershell Regex over array
@(Get-ExchangeServer | Format-List AdminDisplayVersion) | % { [regex]::Match($_, "^\sVersion (\d+\.\d+(\.\d+)?)\s").Success }
命令Get-ExchangeServer | Format-List AdminDisplayVersion
返回以下:
[PS] C:\Windows\system32>Get-ExchangeServer | Format-List AdminDisplayVersion
AdminDisplayVersion : Version 14.0 (Build 442.3)
AdminDisplayVersion : Version 14.0 (Build 442.3)
和應用正則表達式,就當我得到的所有錯誤:
[PS] C:\Windows\system32>@(Get-ExchangeServer | Format-List AdminDisplayVersion) | % { [regex]::Match($_, "^\sVersion (\
d+\.\d+(\.\d+)?)\s").Success }
False
False
False
False
False
False
任何指針作爲我究竟做錯了什麼?
酷!這太棒了,更實用! – Panicos 2012-07-13 11:08:35