I have this code:
My goal is to extract the string that starts with the word IN and ends with a right parenthesis.
When I run this, the result is: IN ('C', 'E', 'F') AND (other stuff))
How come it doesn't stop after the first ) ?
(As a secondary question, since I only want the first occurrence of this, is there any way to code the last bit so I don't need a for loop?)
Thanks!
Dennis
VBA Code:
Dim r As RegExp
Dim s As String
Set r = New RegExp
s = "(code IN ('C', 'E', 'F') AND (other stuff))"
r.Pattern = "IN \(.+\)"
r.Global = False
Set theMatches = r.Execute(s)
For Each Match In theMatches
MsgBox Match.Value
Next
My goal is to extract the string that starts with the word IN and ends with a right parenthesis.
When I run this, the result is: IN ('C', 'E', 'F') AND (other stuff))
How come it doesn't stop after the first ) ?
(As a secondary question, since I only want the first occurrence of this, is there any way to code the last bit so I don't need a for loop?)
Thanks!
Dennis