Using this reg-ex tester: http://myregextester.com/index.php Indicates my regex should work: Regex:
{name:"(\w*?)", rank:([\d]+)},
Sample Data to capture:
{name:"AARON", rank:77},
{name:"ABBEY", rank:1583},
Here's the powershell script I'm attempting to run , to parse json-like data into a powershell grid.
$regex = '{name:"(\w*?)", rank:([\d]+)},'
(Select-String -Path EmailDomains.as -Pattern $regex -AllMatches).matches |foreach {
$obj = New-Object psobject
$obj |Add-Member -MemberType NoteProperty -Name Rank -Value $_.groups[1].value
$obj |Add-Member -MemberType NoteProperty -Name Name -Value $_.groups[0].value
$obj
} |Out-GridView -Title "Test"
The reg-ex never seems to return values (I'm guessing its a MS regex versus Perl regex mixup, but I can't identify), so I'm not sure what the issue could be. Any help is appreciated!