title: Splitting a string but preserving the deliminator in C
body: <p>I want to split a string by alphabetic characters. I started with <code>strtok</code></p>
  <pre><code>char str[] = &quot;A89 99B0 C11D98 9&quot;;
  char delim[] = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;
  
  char *ptr = strtok(str, delim);
  
  while(ptr != NULL)
  {
      printf(&quot;%s\n&quot;, ptr);
      ptr = strtok(NULL, delim);
  }
  </code></pre>
  <p>but I need to preserve the deliminator. Something like</p>
  <pre><code>A89 99
  B0 
  C11
  D98 9
  </code></pre>
  <p>I doubt if it is doable by <code>strtok</code>, and I should look for another approach (e.g., regex).</p>
  <p>One possible solution I thought of is to insert a non-alphanumeric deliminator before each alphabetic character in the string, and then use <code>strtok</code> for this deliminator.</p>