.NET, :
> $s = "blah blah blah (foo:this, bar:that)"
> $result = [regex]::Match($s, '[^(]*\((?:\w+:(?<t>\w+),\s*)*\w+:(?<t>\w+)\)$')
> $result.Groups
Groups : {blah blah blah (foo:this, bar:that), that}
Success : True
Captures : {blah blah blah (foo:this, bar:that)}
Index : 0
Length : 35
Value : blah blah blah (foo:this, bar:that)
Success : True
Captures : {this, that}
Index : 30
Length : 4
Value : that
> $result.Groups[1].captures
Index Length Value
----- ------ -----
20 4 this
30 4 that
PowerShell. PowreShell .NET, .NET.
The parsing expression is based on the example you posted, so it skips everything to (and then starts parsing the values. Please note that this (?:..)is a non-capturing group, so it does not appear in the results.
source
share