diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/regex1.c | 4 | ||||
| -rw-r--r-- | examples/regex_match.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/regex1.c b/examples/regex1.c index 894fe2b1..e244c984 100644 --- a/examples/regex1.c +++ b/examples/regex1.c @@ -10,9 +10,9 @@ int main(int argc, char* argv[]) c_auto (cstr, input) c_auto (cregex, float_expr) { - float_expr = cregex_new("^[+-]?[0-9]+((\\.[0-9]*)?|\\.[0-9]+)$", 0); + int res = cregex_compile(&float_expr, "^[+-]?[0-9]+((\\.[0-9]*)?|\\.[0-9]+)$", 0); // Until "q" is given, ask for another number - while (true) + if (res > 0) while (true) { printf("Enter a double precision number (q for quit): "); cstr_getline(&input, stdin); diff --git a/examples/regex_match.c b/examples/regex_match.c index c5798b60..f543fc31 100644 --- a/examples/regex_match.c +++ b/examples/regex_match.c @@ -25,7 +25,7 @@ int main() printf("Could not find any digits\n"); } - while (cregex_find(&re, s, 1, m, creg_next) > 0) { + while (cregex_find(&re, s, 10, m, creg_next) > 0) { printf("%.*s ; ", (int)m[0].len, m[0].str); } puts(""); |
