Let's say I have the string "blah blah F12 blah blah F32 blah blah blah" and I want to match the F12 and F32, how would I go about capturing both to the Powershell magic variable $matches?
If I run the following code in Powershell:
$string = "blah blah F12 blah blah F32 blah blah blah"
$string -match "F\d\d"
The $matches variable only contains F12
I also tried:
$string -match "(F\d\d)"
This time $matches had two items, but both are F12
I would like $matches to contain both F12 and F32 for further processing. I just can't seem to find a way to do it.
All help would be greatly appreciated. :)
-match
returns two F12 results in the second attempt, it's because F12 is both the result of the whole match expression AND the result of the first match group in the expression (the result of the parentheses...