title: strstr vs regex in c
body: <p>Let's say, for example, I have a list of user id's, access times, program names, and version numbers as a list of CSV strings, like this:</p>
  
  <pre><code>1,1342995305,Some Program,0.98
  1,1342995315,Some Program,1.20
  2,1342985305,Another Program,15.8.3
  1,1342995443,Bob's favorite game,0.98
  3,1238543846,Something else,
  ...
  </code></pre>
  
  <p>Assume this list is <strong>not</strong> a file, but is an in-memory list of strings.</p>
  
  <p>Now let's say I want to find out how often a program has been accessed to certain programs, as listed by their version number. (e.g. <em>"Some Program version 1.20"</em> was accessed 193 times, <em>"Some Program version 0.98"</em> was accessed 876 times, and <em>"Some Program 1.0.1"</em> was accessed 1,932 times)</p>
  
  <p>Would it be better to build a regular expression and then use <code>regexec()</code> to find the matches and pull out the version numbers, or <code>strstr()</code> to match the program name plus comma, and then just read the following part of the string as the version number?  If it makes a difference, assume I am using GCC on Linux.</p>
  
  <p>Is there a performance difference? Is one method "better" or "more proper" than the other? Does it matter at all?</p>