title: Read numbers between delimiters from files
body: <p>I have to read numbers from a file that are separated by paranthesis or different symbols like the following:</p>
  
  <p>(58) [787" {91} (-66]</p>
  
  <p>There is always a space between the numbers and their separators.
  What is have done so far is this:</p>
  
  <pre><code>fgets(line, MAXLINE, source.txt)
  line[strlen(line) - 1] = '\0';
  value = strtok(line, " ");
  while(value != NULL)
  {
      nr = 0;
      for(i = 1; i &lt; strlen(value) - 1; i++)
          nr = nr * 10 + value[i] - '0';
      value = strtok(NULL, " ");
  }
  </code></pre>
  
  <p>Unfortunately, my approach does not work for negative numbers or decimals.
  I suspect there is a better way of doing this with regex.
  Your help would be greatly appreciated.</p>