No way smaller Arduinos will like to spend 1 kilobyte of RAM to parse the string +15103036635,,23/01/16,04:52:51-32Angle into the phone number, date+time and command. If you use String functions (or direct strstr / string.h functions) this can be made much more memory efficient, but that wasn’t your question.
This will try to copy 1024 bytes from the string “\0” into your buffer, as the compiler warns you.
src\main.cpp: In function 'void setup()':
src\main.cpp:52:9: warning: 'void* memcpy(void*, const void*, size_t)' reading 1024 bytes from a region of size 2 [-Wstringop-overflow=]
52 | memcpy(buf1, "\0", sizeof(buf1));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
This should be memset(buf1, '\0', sizeof(buf1); instead.
Another is, as you can see when debugging the code and inspecting some variables,
is that ms.MatchLength does not give you the length of the value returned by ms.GetCapture(), but the length of the string that was matched in total (39). The GSM number part for e.g. would only be 12 characters, plus one null-terminator. So you’re trashing parts of the myQueue memory with unrelated data.
However, the main failure of the program is that, even though you have 3 places in your string where the RegExp matches, the ms.Match() will only return the data for the the first match, not all. So calling ms.GetCapture() with index >= 3 will just give back an empty string.
As you can see in the MatchCount() function
it repeadedly calls Match() and then shifts the start of the string forward to explore possibly new matches that occur later in the string. One can do the same thing by using the index paramter of the Match function like the example does, which will effectively index the string at a later point. However, in your original code, you only do one Match() with index = 0, so you’ll only get one match from that starting position.
Correcting all these issues, we get a nice output of