title: why regexec() of C does not match this pattern, but match() of javascript works?
body: <p>I have this pattern <code>[-]{23}[ ]*Page[ ]*[0-9]*[-]{23}</code>to extract the page number from an string like <code>----------------------- Page 1-----------------------</code> it works fine using javascript regex implementation: </p>
  
  <pre><code>var s = "----------------------- Page 1-----------------------";
  alert( s.match(/[-]{23}[ ]*Page[ ]*[0-9]*[-]{23}/) != null);
  </code></pre>
  
  <p><code>match()</code> function returns the matched string value or <code>null</code> if pattern does not match with string. The above code show <code>true</code></p>
  
  <p>my C code:</p>
  
  <pre><code>#include &lt;assert.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;regex.h&gt;
  
  //... 
  
  regex_t reg;
  regmatch_t match;
  char * line = "----------------------- Page 1-----------------------";
  regcomp(&amp;reg,
            "[-]{23}[ ]*Page[ ]*[0-9]*[-]{23}",
            REG_ICASE /* Don't differentiate case */
      );
  
  int r = regexec(&amp;reg,
           line, /* line to match */
           1, /* size of captures */
           &amp;match,
           0); 
  
  if( r == 0) { printf("Match!"); } else { printf("NO match!"); }
  </code></pre>
  
  <p>the if-statement above print <code>NO match!</code> I have no idea how to fix this. Thanks in advance.</p>