title: scanf limited character set
body: <p>I'm trying to read a input with the following format [A-Z],123 and store the result. For example 'A,123' or 'B , 456' (Single capital letter followed by a colon followed by an integer, white spaces allowed)</p>
  
  <p>I was able to achieve this using several separate calls to scanf. But i'm trying to do it using a single call to scanf.</p>
  
  <p>I don't understand why the following is not working:</p>
  
  <pre><code>char temp[23];
  int a = 0;
  int result = scanf("%1[A-Z]s , %d", temp, &amp;a);
  printf("%d = %d, %s\n", result, a, temp);
  </code></pre>
  
  <p>This code returns 1 and the variable a is never set. I'm compiling using <code>gcc -ansi -pedantic</code></p>