troubleshooting Question

Access 2010 VBA and Regex: Unable to iterate through MatchCollection. Match generates "data member not found" error.

Avatar of stuckp1
stuckp1 asked on
Microsoft AccessVisual Basic ClassicMicrosoft Development
3 Comments1 Solution1293 ViewsLast Modified:
Hi,
The Goal:
I'm trying to use regular expressions to find repeating patterns in a string.
The string is "__CarrierCode__RZP__LocationCode__DQ1__Server1Nr__"
I want to thus find
"__CarrierCode__" , "__LocationCode__" and "__Server1Nr__"
The pattern is (__\w+?__)+

The code I'm using:
    Dim searchStr As String
    searchStr = "__CarrierCode__RZP__LocationCode__DQ1__Server1Nr__"
    Dim regExp As Object
    Set regExp = CreateObject("vbscript.regexp")
    Dim colregmatch As MatchCollection
    With regExp
        .Pattern = "(__\w+?__)+"
        .IgnoreCase = True
        .Global = True
        .Multiline = True
    End With
    
    
    Set colregmatch = regExp.Execute(searchStr)
    Dim match As match
    
    
    For Each match In colregmatch
        Debug.Print match.Groups(1).Value
    Next

The Problem
The type Match is known by Intellisense, but not by the compiler.
I get a "data member not found" for match.Groups(1).Value.

Illustrating screen shots
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros