I am learning RegEX right now for a parser that is parsing responses from a TCP/IP Device. So far this is going really well, however I am stuck on this one:
I would like to check if the string starts with the word ALL; after I would like to get each 2 digits either as a group, or as separate matches. The number of 2 digit numbers may vary.
the number to expect differs by device type, it can be anything from 8 to 16. So by repeatedly running the pattern on the other groups you mean do one regex, and then do a seperate regex on the result of the first reg ex?
Yes, I know there won’t be more than 16. I’m doing an OS X software for a product that has a rather shitty webinterface, a Windows software and is not able to backup settings - so I’m adding that to my little tool.
To offer an alternative to RegEx - you can also use SplitB and an Array:
Dim theGroups(-1) As String
If LeftB(theMessage, 3) = "ALL" Then
theGroups = SplitB(theMessage, " ")
End If
You can then use theGroups.Ubound + 1 to get the number of groups. You can then use the array methods to further deal with the resulting members.