title: Powershell regular expression match return empty string
body: <p>I am using regular expression to find strings in Powershell, and match function returns empty string lines as well as matched lines.</p>
  
  <p>For the following four lines of text file input.txt,</p>
  
  <pre><code>[abc]
  
  abc
  
  [123]
  
  123
  </code></pre>
  
  <p>The code below prints out <code>abc/blank line/123/blank line</code>. I expected it only prints out <code>abc</code> and <code>123</code>, wonder how this happened.</p>
  
  <pre><code>$readArray = Get-Content(input.txt)
  foreach($line in $readArray) {
     $re = [regex] *** // Find the string in bracket
  
     $key = $re.match($line)
     if($key -ne $null) {
        write-host -$key.group[1].value
     }
  }
  </code></pre>