diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-02-06 12:09:43 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-02-06 12:09:43 +0000 |
commit | 3af9b11229f79d3e6347a2e628772a729c644016 (patch) | |
tree | 03beec1fc9e2de5d79b196bc46fb5b9056f8b1c6 /comp/work/44/regex.c | |
parent | 02653ab40d93fb7e6d07edb747fe0e07c5d60c74 (diff) |
did some interesting work
Diffstat (limited to 'comp/work/44/regex.c')
-rw-r--r-- | comp/work/44/regex.c | 15 |
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); +} |