Reputation: 780
how can I match the beginning of a line with keyword "dog" that the end is a equal sign what I have is not working
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim iString As String = "cats=123" & vbCrLf & "dog=456"
Dim q1 = System.Text.RegularExpressions.Regex.Match(iString, "^dog=")
If q1.Success Then
Debug.Print("found")
Else
Debug.Print("not found")
End If
End Sub
Upvotes: 0
Views: 817
Reputation: 43023
You had it almost ok, you just need an option to treat the input as multi line:
Dim q1 = System.Text.RegularExpressions.Regex.Match(iString, "^dog=", RegexOptions.Multiline)
Upvotes: 1