我有我在PowerShell中我處理我試圖提取所有活動名稱以及使用-match
操作的持續時間,但我只得到一個比賽組回以下日誌項。我沒有得到的一切,我看到的時候我使用Regex
對象做同樣的事情在C#中的比賽。有人能解釋我做錯了什麼嗎?的PowerShell -match運算和多組
相關PowerShell腳本
$formattedMessage -match "(Get\sClient\sModel|Parse\sExpression|Get\sAbstract\sQuery|Compile\sQuery|Execute\sQuery|Get\sQuery\sPlan\sComplexity|Async\sTotal|Total)\s-\sduration\(([0-9]*)" | out-null
$matches
輸出
Name Value
---- -----
0 Get Client Model - duration(0
1 Get Client Model
2 0
日誌條目示例:
Timestamp: 11/9/2009 6:48:41 PM
Message:
Category: QueryService
Priority: 3
EventId: 1001
Severity: Information
Title: SPARQL Query Response
Machine: SPOON16-SERVER
App Domain: KnowledgeBaseHost.exe
ProcessId: 2040
Process Name: D:\QueryService\QSHost.exe
Thread Name:
Win32 ThreadId:8092
Extended Properties:
Key - Workflow_cbbdd58b-e574-4054-88d4-1dd7a56dc9d9
Timeout - 1800
Result Format - WireTable
Result from Registry - False
Compiled Query from Cache - True
Result Count - 28332
Query Plan Complexity - 661622
Get Client Model - duration(0) start(0)
Parse Expression - duration(0) start(0)
Get Abstract Query - duration(0) start(0)
Compile Query - duration(0) start(0)
Get Query Plan - duration(0) start(1)
Execute Query - duration(63695) start(1)
Get Query Plan Complexity - duration(0) start(63696)
Get Executed Operations - duration(0) start(63696)
Total - duration(63696) start(0)
Async Total - duration(63696) start(0)
最佳答案,讓您能夠將結果分配給一個變量很容易使你可以處理它作爲一個匹配的數組。 – sonjz 2014-06-12 17:11:34