title: Extract Excel string from matched Regular Expression (VBA)
body: <p>I would like to extract the matched RegExp pattern from a given string in Excel VBA. </p>
  
  <p>For example,</p>
  
  <p>Given this expression:  </p>
  
  <pre><code>"[0-9]*\+[0-9]{3}\@[0-9]*\+[0-9]{3}"
  </code></pre>
  
  <p>from this string:
  "CSDT2_EXC_6+000@6+035_JM_150323"</p>
  
  <p>I'd like to get: "6+000@6+035"</p>
  
  <p>But I don't know how to accomplish this. </p>
  
  <p>The nearest I could get was this:</p>
  
  <pre><code>Function getStations(file_name As String)
  
  'Use Regular Expressiosn for grabbing the input and automatically filter it
  Dim regEx As New RegExp
  
  With regEx
      .Global = True
      .MultiLine = True
      .IgnoreCase = True
      'This matches the pattern: e.g. 06+900@07+230
      .Pattern = "[0-9]*\+[0-9]{3}\@[0-9]*\+[0-9]{3}"
  End With
  
  If regEx.Test(file_name) Then
      strReplace = ""
      getStations = regEx.Replace(file_name, strReplace)
  Else
      getStations = "Hay un problema con el nombre. Por favor, arréglalo"
  End If
  
  
  End Function
  </code></pre>
  
  <p>But this would bring me the following:
  "CSDT2_EXC__JM_150323"</p>
  
  <p>I'd like to only take the matched pattern. How can I achieve this? </p>
  
  <p>Thanks a million for all the replies ;) </p>