title: Use the regex.h C library in Cython
body: <p>I want to use the regex.h library in my Cython code because the build-in re module seems to be very slow but I have a lot of trouble doing it. I understand that I have to create a .pxd file and use it as an external module in my code but I'm really new in Python/Cython..</p>
  
  <p><strong>This is my regex.pxd file:</strong> </p>
  
  <pre><code>cdef extern from *:
      ctypedef char const_char "const char"
  
  cdef extern from "regex.h" nogil:
      int regcomp(regex_t* PREG, const char* REGEX, int CFLAGS)
      int regexec(const regex_t *PREG, const char *STRING, size_t NMATCH, regmatch_t   PMATCH[], int EFLAGS)
  </code></pre>
  
  <p>I'm running the command : <code>$python setup.py build_ext --inplace</code></p>
  
  <p><strong>And I'm getting this error after doing</strong>:</p>
  
  <pre><code>regex.pxd:6:27: Expected ')', found '*'
  </code></pre>
  
  <p>Do you have any other ideas on how I could use the <code>regex.h</code> library within my <code>Cython</code> code?</p>