title: PowerShell and RegEx: match whole line except space and empty lines
body: <p>I'm still having problems with the understanding of RegEx.</p>
  
  <p>I have a Textbox in Powershell which is supposed to receive several Groups of a domain.
  like:</p>
  
  <pre><code>G-ITDep-Location-RWXD
  G-R-ITHR-666-42-All-RWXD
  
  G-R-ITHR-666-42-All-EndUsers
   SP-P-TKDep-ISIS-Member 
  Domain Users
  </code></pre>
  
  <p>With the input I want to get the groupmembers of each group via Get-ADGroupMember. However, with my current regex, I can only capture every single line.
  While this is ok for myself, I have to think about my colleges and possible errors. In case of my example above, there is one empty line and a "space" at the beginning and end of another line.
  So how do I filter out empty lines and leading/ending whitespace characters?</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>$Groups = [regex]::Matches($textboxUseradminInput.Text, '(?mi)^(.*)$')
  foreach ($do in $Groups)
              {
                  $richtextboxgetGroupsGrpMembers.Text += "$do" + ":`n"
                  $richtextboxgetGroupsGrpMembers.Text += Get-ADGroupMember -Identity "$do" -Server "192.168.3.99" |`
                  foreach { $_.Name } | Out-String
  }
  </code></pre>