I am scraping a web request response to pull information held within html code which repeats a few times so using select-string rather than match. My code looks like
$regexname = '\(\w{0,11}).{1,10}\'
$energenie.RawContent | select-string $regexname -AllMatches | % {$_.matches}
The return looks something like:
Groups : {<h2 class="ener">TV </h2>, TV}
Success : True
Captures : {<h2 class="ener">TV </h2>}
Index : 1822
Length : 33
Value : <h2 class="ener">TV </h2>
Groups : {<h2 class="ener">PS3 </h2>, PS3}
Success : True
Captures : {<h2 class="ener">PS3 </h2>}
Index : 1864
Length : 33
Value : <h2 class="ener">PS3 </h2>
I can't workout a way to grab the second element of groups e.g. TV or PS3 as:
$energenie.RawContent | select-string $regexname -AllMatches | % {$_.matches.groups}
Gives a strange output
Paul