summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/regularexpressions
diff options
context:
space:
mode:
Diffstat (limited to 'misc/examples/regularexpressions')
-rw-r--r--misc/examples/regularexpressions/regex2.c2
-rw-r--r--misc/examples/regularexpressions/regex_match.c4
-rw-r--r--misc/examples/regularexpressions/regex_replace.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/misc/examples/regularexpressions/regex2.c b/misc/examples/regularexpressions/regex2.c
index a798b1a1..85890070 100644
--- a/misc/examples/regularexpressions/regex2.c
+++ b/misc/examples/regularexpressions/regex2.c
@@ -27,7 +27,7 @@ int main(void)
c_formatch (j, &re, s[i].input) {
c_forrange (k, cregex_captures(&re) + 1)
- printf(" submatch %lld: %.*s\n", k, c_SV(j.match[k]));
+ printf(" submatch %lld: %.*s\n", k, c_SS(j.match[k]));
}
}
cregex_drop(&re);
diff --git a/misc/examples/regularexpressions/regex_match.c b/misc/examples/regularexpressions/regex_match.c
index 11426d2d..6eaea781 100644
--- a/misc/examples/regularexpressions/regex_match.c
+++ b/misc/examples/regularexpressions/regex_match.c
@@ -1,7 +1,7 @@
#define i_import
#include <stc/cregex.h>
#define i_implement
-#include <stc/csview.h>
+#include <stc/csubstr.h>
#define i_key float
#include <stc/cstack.h>
@@ -28,7 +28,7 @@ int main(void)
printf(" %g\n", (double)*i.ref);
// extracts the numbers only to a comma separated string.
- cstr nums = cregex_replace_sv(&re, csview_from(str), " $0,", 0, NULL, CREG_STRIP);
+ cstr nums = cregex_replace_ss(&re, csubstr_from(str), " $0,", 0, NULL, CREG_STRIP);
printf("\n%s\n", cstr_str(&nums));
cstr_drop(&nums);
diff --git a/misc/examples/regularexpressions/regex_replace.c b/misc/examples/regularexpressions/regex_replace.c
index f1ea2711..f5fd8691 100644
--- a/misc/examples/regularexpressions/regex_replace.c
+++ b/misc/examples/regularexpressions/regex_replace.c
@@ -1,8 +1,8 @@
#define i_import
#include <stc/cregex.h>
-#include <stc/csview.h>
+#include <stc/csubstr.h>
-bool add_10_years(int i, csview match, cstr* out) {
+bool add_10_years(int i, csubstr match, cstr* out) {
if (i == 1) { // group 1 matches year
int year;
sscanf(match.str, "%4d", &year); // scan 4 chars only
@@ -47,7 +47,7 @@ int main(void)
printf("euros: %s\n", cstr_str(&str));
/* Strip out everything but the matches */
- cstr_take(&str, cregex_replace_sv(&re, csview_from(input), "$3.$2.$1;", 0, NULL, CREG_STRIP));
+ cstr_take(&str, cregex_replace_ss(&re, csubstr_from(input), "$3.$2.$1;", 0, NULL, CREG_STRIP));
printf("strip: %s\n", cstr_str(&str));
/* Wrap all words in ${} */