title: C++ regular expression with regexec() don't match
body: <p>I'm trying to make a regular expression to evaluate a sequence of numbers begining with an underscore like this: _201312
  I have problems with the numeric part; I always receive the REG_NOMATCH message.
  Here is the code:</p>
  
  <pre><code>#include &lt;regex.h&gt;
  
  int result_exp,flag_buffer=0;
  regex_t rx_t;
  regmatch_t match[10];
  result_exp = regcomp(&amp;rx_t,"^[0-9]+$",REG_NOSUB); //
  if(result_exp==0){
      printf("result_exp es 0\n");
  }else if(result_exp == REG_BADBR){
      printf("REG_BADBR\n");
  }else if(result_exp == REG_BADPAT){
      printf("REG_BADPAT\n");
  }
  result_exp = regexec(&amp;rx_t, tableName.c_str(), 0, 0, 0);
  if(result_exp==0){ //match
      flag_buffer=1;  
  }else if(result_exp == REG_NOMATCH){
      printf("REG_NOMATCH\n");
  }
  </code></pre>
  
  <p>I tried with this expression too:</p>
  
  <pre><code>result_exp = regcomp(&amp;rx_t,"[[:digit:]]+",REG_NOSUB);
  </code></pre>
  
  <p>I used the REG_NOSUB flag and then I don't, and the result was the same.</p>
  
  <p>Do you have any idea?</p>
  
  <p>Thanks</p>