title: excel VB regexp 5.5 capturing group
body: <p>I have a problem using regexp in excel macro, by calling regex.execute(string), instead of getting an array of returned capturing groups, I always get single return which is the whole string specified in the pattern.
  By using the same pattern in <a href="http://www.regexr.com/" rel="nofollow">http://www.regexr.com/</a>, I can see the return nicely grouped. What am I missing from this:</p>
  
  <pre><code>Private Sub ParseFileName(strInput As String)
      Dim regEx As New RegExp
      Dim strPattern As String
      Dim strReplace
  
      'Sample string \\Work_DIR\FTP\Results\RevA\FTP_01_01_06_Results\4F\ACC2X2R33371_SASSSD_run1
      strPattern = "FTP_(\w+)_Results\\(\w+)\\([\d,\D]+)_(SAS|SATA)(HDD|SSD)_run(\d)"
  
      With regEx
          .Global = True
          .MultiLine = False
          .IgnoreCase = False
          .Pattern = strPattern
      End With
  
      If regEx.Test(strInput) Then
          Set strReplace = regEx.Execute(strInput)
          ActiveCell.Offset(0, 1) = strReplace.Count
      Else
          ActiveCell.Offset(0, 1) = "(Not matched)"
      End If
  End sub
  </code></pre>
  
  <p>In the end, <code>strReplace.Count</code> always shows 1, which is the whole string FTP_01_01_06_Results\4F\ACC2X8R133371_SASSSD_run1</p>