diff options
| author | Tyge Løvset <[email protected]> | 2022-07-23 22:15:02 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-07-23 22:15:02 +0200 |
| commit | 2bae847079852eb808e50a136659e98898616bef (patch) | |
| tree | 2e20ad200e608f4db6728b97fd6a4ebda4350c83 /examples | |
| parent | c1ecb1ac75664b0771993582fda9919e52d03a2d (diff) | |
| download | STC-modified-2bae847079852eb808e50a136659e98898616bef.tar.gz STC-modified-2bae847079852eb808e50a136659e98898616bef.zip | |
Fixed a few small issues with cregex.c Reverted cregex_match() to cregex_find(). Renamed cre_* flags.
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 98fc644d..7e8040ac 100644 --- a/examples/regex1.c +++ b/examples/regex1.c @@ -22,7 +22,7 @@ int main(int argc, char* argv[]) if (cstr_equals(input, "q")) break; - if (cregex_match(cstr_str(&input), &float_expr, NULL, 0) == 1) + if (cregex_is_match(cstr_str(&input), &float_expr, 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 23f774ba..307579d4 100644 --- a/examples/regex2.c +++ b/examples/regex2.c @@ -20,7 +20,7 @@ int main() } csview m[20]; printf("input: %s\n", inputs[i]); - if (cregex_match(inputs[i], &re, m, 0) == 1) + if (cregex_find(inputs[i], &re, m, 0) == 1) { c_forrange (j, cregex_captures(&re)) { diff --git a/examples/regex_match.c b/examples/regex_match.c index 821813bb..cb0fdd11 100644 --- a/examples/regex_match.c +++ b/examples/regex_match.c @@ -15,20 +15,20 @@ int main() int res = cregex_compile(&re, "[+-]?([0-9]*\\.)?\\d+([Ee][+-]?\\d+)?", 0); printf("%d\n", res); csview m[5]; - if (cregex_match(s, &re, m, 0) == 1) { + if (cregex_find(s, &re, m, 0) == 1) { 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_match(s, &re, m, cre_NEXT) == 1) { + while (cregex_find(s, &re, m, cre_m_next) == 1) { printf("%" c_PRIsv " ; ", c_ARGsv(m[0])); } puts(""); res = cregex_compile(&re, "(.+)\\b(.+)", 0); printf("groups: %d\n", res); - if ((res = cregex_match("hello@wørld", &re, m, 0)) == 1) { + if ((res = cregex_find("hello@wørld", &re, m, 0)) == 1) { c_forrange (i, res) printf("match: [%" c_PRIsv "]\n", c_ARGsv(m[i])); } else |
