diff options
| author | Tyge Løvset <[email protected]> | 2022-06-12 18:51:24 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-06-12 18:51:24 +0200 |
| commit | 2e289403cdeb998a38fd9467f05e9e8525cb69e7 (patch) | |
| tree | bf48c7bc93faf4db7b8adb9f71db92fbd8fb9e33 /examples | |
| parent | 69e930f36ab18999009d064f08e2a0b4f10733b3 (diff) | |
| download | STC-modified-2e289403cdeb998a38fd9467f05e9e8525cb69e7.tar.gz STC-modified-2e289403cdeb998a38fd9467f05e9e8525cb69e7.zip | |
Renamed cregex_find89 => cregex_match()
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/regex1.c | 2 | ||||
| -rw-r--r-- | examples/regex2.c | 2 | ||||
| -rw-r--r-- | examples/regex_match.c | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/examples/regex1.c b/examples/regex1.c index f2623f7a..09e4299d 100644 --- a/examples/regex1.c +++ b/examples/regex1.c @@ -21,7 +21,7 @@ int main(int argc, char* argv[]) if (cstr_equals(input, "q")) break; - if (cregex_find(&float_expr, cstr_str(&input), 0, NULL, 0) > 0) + if (cregex_match(&float_expr, cstr_str(&input), 0, NULL, 0) > 0) printf("Input is a float\n"); else printf("Invalid input : Not a float\n"); diff --git a/examples/regex2.c b/examples/regex2.c index 41266b65..82247da5 100644 --- a/examples/regex2.c +++ b/examples/regex2.c @@ -20,7 +20,7 @@ int main() } cregmatch m[20]; printf("input: %s\n", inputs[i]); - if (cregex_find(&re, inputs[i], 20, m, 0) > 0) + if (cregex_match(&re, inputs[i], 20, m, 0) > 0) { c_forrange (j, cregex_captures(re)) { diff --git a/examples/regex_match.c b/examples/regex_match.c index 05161b90..2b135bb7 100644 --- a/examples/regex_match.c +++ b/examples/regex_match.c @@ -14,20 +14,20 @@ int main() int res = cregex_compile(&re, "[+-]?([0-9]*\\.)?\\d+([Ee][+-]?\\d+)?", 0); printf("%d\n", res); cregmatch m[10]; - if (cregex_find(&re, s, 10, m, 0) > 0) { + if (cregex_match(&re, s, 10, m, 0) > 0) { printf("Found digits at position %" PRIuMAX "-%" PRIuMAX "\n", m[0].str - s, m[0].str - s + m[0].size); } else { printf("Could not find any digits\n"); } - while (cregex_find(&re, s, 10, m, creg_next) > 0) { + while (cregex_match(&re, s, 10, m, creg_next) > 0) { printf("%" c_PRIsv " ; ", c_ARGsv(m[0])); } puts(""); res = cregex_compile(&re, "(.+)\\b(.+)", 0); printf("groups: %d\n", res); - if ((res = cregex_find(&re, "hello@wørld", 10, m, 0)) > 0) { + if ((res = cregex_match(&re, "hello@wørld", 10, m, 0)) > 0) { c_forrange (i, res) printf("match: [%" c_PRIsv "]\n", c_ARGsv(m[i])); } else |
