summaryrefslogtreecommitdiff
path: root/comp/work/44/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'comp/work/44/regex.c')
-rw-r--r--comp/work/44/regex.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/comp/work/44/regex.c b/comp/work/44/regex.c
new file mode 100644
index 0000000..6697836
--- /dev/null
+++ b/comp/work/44/regex.c
@@ -0,0 +1,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);
+}