summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/regex1.c2
-rw-r--r--examples/regex2.c2
-rw-r--r--examples/regex_match.c6
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