.h&gt;
#include &lt;pcre.h&gt;

int main(int argc, char **argv)
{
    pcre *p;
    char *re = "";
    char *s  = "foo";
    const char *errmsg;
    int errpos;
    int ovector[10];
    int ret;

    p = pcre_compile(re, 0, &amp;errmsg, &amp;errpos, NULL);
    ret = pcre_exec(p, NULL, s, strlen(s), 0, 0,
                    ovector, sizeof ovector / sizeof *ovector);

    printf(ret &lt; 0 ? "no match\n" : "match\n");
}
$ <kbd>cc -lpcre pcre.c && ./a.out</kbd>
match</samp>
</pre>
