Imports System.Text.RegularExpressions
Dim events_process = "MSTAT01P0K0S0^ MSTAT02P1K1S1^ MSTAT03P0K0S0^ MSTAT04P1K1S1^"
Dim Sched_Num As String = String.Empty
Dim KS_Status As String = String.Empty
Dim SSR_Status As String = String.Empty
Dim Photocell_Status As String = String.Empty
Dim matches As MatchCollection = Regex.Matches(events_process, "(M[^\^]+\^)")
For Each m As Match In matches
For Each c As Capture In m.Captures
Dim CSTAT_Cmd As Boolean = c.Value Like "MSTAT??P?K?S?^*"
Sched_Num = c.Value.Substring(5, 2)
Photocell_Status = c.Value.Substring(8, 1)
KS_Status = c.Value.Substring(10, 1)
SSR_Status = c.Value.Substring(12, 1)
Console.WriteLine(Sched_Num & " " & Photocell_Status & " " & KS_Status & " " & SSR_Status)