Pagini recente » Cod sursa (job #1046014) | Cod sursa (job #2919484) | Cod sursa (job #459145) | Cod sursa (job #1589342) | Cod sursa (job #490305)
Cod sursa(job #490305)
#include <cstdio>
#include <regex.h>
int
match(const char *string, char *pattern)
{
int status;
regex_t re;
if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) {
return(0); /* report error */
}
status = regexec(&re, string, (size_t) 0, 0, 0);
regfree(&re);
if (status != 0) {
return(0); /* report error */
}
return(1);
}
char p[20];
int main()
{
p[0]='e';
p[1]='l';
p[2]='l';
p[3]='o';
return match("helo",p);
}