I've been working with Regex and I've run into something that doesn't make sense to me; I either misunderstood how the Multiline option works, I'm not using it right, or it really just doesn't work like it's supposed to. This is a little test I made:
vb.net Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim TestString As String = "test" & vbNewLine & "sweet"
Dim TestRegex As String = "^[a-z]*$"
Dim ResultsString As String = String.Empty
For Each StringMatch In System.Text.RegularExpressions.Regex.Matches(TestString, TestRegex, _
System.Text.RegularExpressions.RegexOptions.Multiline)
ResultsString &= StringMatch
Next
Console.WriteLine(resultsstring)
End Sub
The problem is, the only match that is found is the last line (in this case "sweet"). Why is this?