summaryrefslogtreecommitdiff
path: root/comp/work/44/regex.c
blob: 66978365c37b0b5eb9ed66cea0308f444cc475c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdlib.h>
#include <regex.h>
#include <stdio.h>

void eprint(char *msg){
fprintf(stderr, "%s\n", msg);
exit(1);
}

int main(){
regex_t expr;
if (regcomp(&expr, "(1|0)+", 0) != 0) eprint("regcomp failed!");
int ret = regexec(&expr, "1010", 0, NULL, 0);
printf("%d\n", ret);
}