Chris,
I think your problem is that you are searching for the line termination
characters and don't have them in your test string, but do have them in the
text box you are using to test the expression (using Expresso?). Try
changing the second line of your code to:
Dim testString As String = "Me.Button1.Name = 'Button1'" & vbCrLf
Jim
"Chris W." <Gu*******@No.Spam.Yahoo.Com> wrote in message
news:gt********************************@4ax.com...
I'm having a problem and it's driving me crazy. This code does
not work when run under VB.NET, but it works in 2 regular expression
evaluators. Am I missing something here?
Chris
-----------
Sub test()
Dim testString As String = "Me.Button1.Name = 'Button1'"
Dim regVars As New Regex( _
"(?:^\s*)(?<name>.*)\s*=\s*(?<value>.*)(?=\r\n )", _
RegexOptions.IgnoreCase _
Or RegexOptions.Multiline _
Or RegexOptions.Compiled _
)
Dim regMC As MatchCollection = regVars.Matches(testString)
If regMC.Count > 0 Then
MsgBox("Success")
End If
End Sub