Project

General

Profile

Bug #557 ยป re.c

regular expression C example - WimYedema (Wim Yedema), 09/10/2008 09:15 PM

 
#include <sys/types.h>
#include <regex.h>

int main(void)
{
regex_t preg;
regmatch_t pmatch;
regcomp (&preg, "foo|footer", REG_EXTENDED);
regexec (&preg, "footer", 1, &pmatch, 0);
printf ("match: %d, %d\n", pmatch.rm_so, pmatch.rm_eo);
return 0;
}
    (1-1/1)