Using sscanf to Extract Strings

Consider the problem of taking a string of the form;

	a MyArr[Bill]=/turtle/

and extracting the name "Bill" and the nickname "turtle.

Consider the following code (which works). The numbers are not really part of the code. Rather, they are references in the discussion.

#include <stdio.h>

   char line[80], s1[80], s2[80], s3[80], s4[80], s5[80], s6[80];

   strcpy(line, "a MyArr[Bill]=/turtle/");

   sscanf(line, "%s %[^\[]%[\[]%[a-z,A-Z]%[\]=/]%[^/]",
		  1    2     3      4      5       6
		 s1,   s2,   s3,   s4,    s5,     s6);

It is best to use these concepts and then use trial and error, observing the results using the debugger.