title: VBA Regular Expression to Match Date
body: <p>I'm new to Regular Expressions and am having difficulty getting patterns that I find online to work in VBScript/VBA. This one is supposed to return a date found in a string but it fails to find any dates. What does VBScript/VBA do different than other RegEx engines that makes this fail to return a match?</p>
  
  <p><strong>Edit1</strong><br>
  I removed the ^ and the $ from my pattern. The problem persists.</p>
  
  <pre><code>Private Sub TestDate()
      MsgBox RegExDate("cancel on 12/21/2010 ")
  End Sub
  
  Private Function RegExDate(s As String) As String
      Dim re, match
      Set re = CreateObject("vbscript.regexp")
      re.Pattern = "(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))"
      re.Global = True
  
      For Each match In re.Execute(s)
          MsgBox match.value
          RegExDate = match.value
          Exit For
      Next
      Set re = Nothing
  End Function
  </code></pre>