In PowerShell I find myself doing this kind of thing over and over again for matches:
some-command | select-string \'^(//[^#]*)\' | %{some-other-command
You can use the -match operator to reformulate your command as:
-match
some-command | Foreach-Object { if($_ -match '^(//[^#]*)') { some-other-command $($matches[1])}}