title: Convert result of matches from regex into list of string
body: <p>How can I convert the list of match result from regex into <code>List&lt;string&gt;</code>? I have this function but it always generate an exception,</p>
  
  <blockquote>
    <p>Unable to cast object of type 'System.Text.RegularExpressions.Match'
    to type 'System.Text.RegularExpressions.CaptureCollection'.</p>
  </blockquote>
  
  <pre><code>public static List&lt;string&gt; ExtractMatch(string content, string pattern)
  {
      List&lt;string&gt; _returnValue = new List&lt;string&gt;();
      Match _matchList = Regex.Match(content, pattern);
      while (_matchList.Success)
      {
          foreach (Group _group in _matchList.Groups)
          {
              foreach (CaptureCollection _captures in _group.Captures) // error
              {
                  foreach (Capture _cap in _captures)
                  {
                      _returnValue.Add(_cap.ToString());
                  }
              }
          }
      }
      return _returnValue;
  }
  </code></pre>
  
  <p>If I have this string,</p>
  
  <pre><code>I have a dog and a cat.
  </code></pre>
  
  <p>regex</p>
  
  <pre><code>dog|cat
  </code></pre>
  
  <p>I want that the function will return of result into <code>List&lt;string&gt;</code></p>
  
  <pre><code>dog
  cat
  </code></pre>