Imports System
Imports System.Text.RegularExpressions
Public Module Module1
Public Sub Main()
Dim data As String = "M123456789^M123^C123^M1234^"
Dim m As Match = Regex.Match(data, "(M[^\^]+\^)")
While m.Success
Console.WriteLine(m.Groups(1))
m = m.NextMatch()
End While
End Sub
End Module