title: Why regex always returns 1?
body: <p>The following function checks if a variable name start with a letter and may have preceding characters which are letters/ numbers. Why does the return value is always 1 no matter what the input is?</p>
  
  <pre><code>#include &lt;regex.h&gt;
  #include &lt;stdio.h&gt;
  
  int validate_var(char *str)
  {
      regex_t reg;
      regcomp(&amp;reg, "^[a-zA-Z]+[a-zA-Z0-9]*$", 0);
      int r = regexec(&amp;reg, str, 0, NULL, 0);
      regfree(&amp;reg);
  
      return r;
  }
  
  int main() {
      printf("%d\n", validate_var("abc")); // Reports 1, This makes sense
      printf("%d\n", validate_var("17"));  // Reports 1, This doesn't make sense
  }
  </code></pre>