diff options
| author | Tyge Løvset <[email protected]> | 2022-02-06 16:15:41 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-02-06 16:15:41 +0100 |
| commit | fcdbc1ac6b7e6f65d4dde37ed7552707863fcf80 (patch) | |
| tree | e69151631d9e823eac1f284723fffe96cc9ea901 /examples | |
| parent | d68d26d55881cac66be4ab357c08add8c348f083 (diff) | |
| download | STC-modified-fcdbc1ac6b7e6f65d4dde37ed7552707863fcf80.tar.gz STC-modified-fcdbc1ac6b7e6f65d4dde37ed7552707863fcf80.zip | |
Misc improvements.
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(""); |
