Parsing serial string into variables

a simple example using strtok() to parse tokens

// strtok example - parse tokens

void setup() {
  // put your setup code here, to run once:
    Serial.begin(115200);
    char str[] ="RL3]\[Test 1}|{3}|{S]\[Test 2}|{41}|{L]\[Test 3}|{1234}|{L";    // text to tokenise
    char * pch;                     // pointer to tokens
    Serial.print("Splitting string ");
    Serial.print(str);
    Serial.println(" into tokens:");
    pch = strtok (str,"}]\[|{");         // get first token
    while (pch != NULL)
      {
      int x=999;
      Serial.print("string found ");
      Serial.println(pch);          // print it
      pch = strtok (NULL, "}]\[|{");     // get next token
     }  
}

void loop() {}

gives

Splitting string RL3][Test 1}|{3}|{S][Test 2}|{41}|{L][Test 3}|{1234}|{L into tokens:
string found RL3
string found Test 1
string found 3
string found S
string found Test 2
string found 41
string found L
string found Test 3
string found 1234
string found L