From af1b2068b39deebfbf723532a2eddc49da61894a Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 11 Jan 2022 00:27:44 +0100 Subject: Removed regex for now. --- examples/regex1.c | 26 -------------------------- examples/regex2.c | 26 -------------------------- examples/regex_match.c | 35 ----------------------------------- 3 files changed, 87 deletions(-) delete mode 100644 examples/regex1.c delete mode 100644 examples/regex2.c delete mode 100644 examples/regex_match.c (limited to 'examples') diff --git a/examples/regex1.c b/examples/regex1.c deleted file mode 100644 index 9b450453..00000000 --- a/examples/regex1.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -int main() -{ - c_auto (cstr, input) - c_auto (cregex, float_expr) - { - float_expr = cregex_new("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)"); - // Until "q" is given, ask for another number - while (true) - { - printf("Enter float number (q for quit): "); - cstr_getline(&input, stdin); - - // Exit when the user inputs q - if (cstr_equals(input, "q")) - break; - - if (cregex_is_match(&float_expr, input.str)) - printf("Input is a float\n"); - else - printf("Invalid input : Not a float\n"); - } - } -} \ No newline at end of file diff --git a/examples/regex2.c b/examples/regex2.c deleted file mode 100644 index 0562af00..00000000 --- a/examples/regex2.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -int main() -{ - const char* fnames[] = {"home/foofile.txt", "cool/barfile.txt", "test/bazboy.dat", "hello/zoidberg"}; - c_auto (cregex, re) - { - re = cregex_new("([a-z]+)\\/([a-z]+)\\.([a-z]+)"); - - c_forrange (i, c_arraylen(fnames)) - { - printf("%s\n", fnames[i]); - if (cregex_is_match(&re, fnames[i])) - { - c_forrange (j, cregex_capture_size(re)) - { - csview cap; cregex_capture_v(&re, j, &cap); - printf(" submatch %zu: " c_PRIsv "\n", j, c_ARGsv(cap)); - } - puts(""); - } - } - } -} diff --git a/examples/regex_match.c b/examples/regex_match.c deleted file mode 100644 index 72adeb8e..00000000 --- a/examples/regex_match.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include -#define i_val double -#define i_type Vecu64 -#include -#include - - -int main() -{ - // Lets find the first sequence of digits in a string - const char *s = "Hello numeric world, there are 24 hours in a day, 3600 seconds in an hour." - " Around 365.25 days a year, and 52 weeks in a year." - " Boltzmann const: 1.38064852E-23, is very small." - " Bohrradius is 5.29177210903e-11, and Avogadros number is 6.02214076e23."; - - c_auto (cregex, re) - { - re = cregex_new("[+-]?([0-9]*\\.)?[0-9]+([Ee][-+]?[0-9]+)?"); - cregex_match match; - if (cregex_find(&re, s, &match)) { - printf("Found digits at position %zu-%zu\n", match.start, match.end); - } else { - printf("Could not find any digits\n"); - } - - csview sv = {0}; - while (cregex_find_next_v(&re, s, &sv)) { - printf(c_PRIsv " ; ", c_ARGsv(sv)); - } - puts(""); - } -} \ No newline at end of file -- cgit v1.2.3