summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/regex_replace.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-07-18 02:36:04 +0200
committerGitHub <[email protected]>2023-07-18 02:36:04 +0200
commitda70303c149b37dbf442e41038a00836132562ee (patch)
tree06d795c66d6759e06de5f2d166215b461ac40d1d /misc/examples/regex_replace.c
parent071b41c0fe95cb3f9a72bbe0417d856e7989ca08 (diff)
parent23eeedb3fc298602732f394adba6a43c876ca7d8 (diff)
downloadSTC-modified-da70303c149b37dbf442e41038a00836132562ee.tar.gz
STC-modified-da70303c149b37dbf442e41038a00836132562ee.zip
Merge branch 'dev43' into master
Diffstat (limited to 'misc/examples/regex_replace.c')
-rw-r--r--misc/examples/regex_replace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/misc/examples/regex_replace.c b/misc/examples/regex_replace.c
index d3952f50..f1ea2711 100644
--- a/misc/examples/regex_replace.c
+++ b/misc/examples/regex_replace.c
@@ -1,4 +1,4 @@
-#define i_extern
+#define i_import
#include <stc/cregex.h>
#include <stc/csview.h>
@@ -12,7 +12,7 @@ bool add_10_years(int i, csview match, cstr* out) {
return false;
}
-int main()
+int main(void)
{
const char* pattern = "\\b(\\d\\d\\d\\d)-(1[0-2]|0[1-9])-(3[01]|[12][0-9]|0[1-9])\\b";
const char* input = "start date: 2015-12-31, end date: 2022-02-28";
@@ -47,7 +47,7 @@ int main()
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_R_STRIP));
+ cstr_take(&str, cregex_replace_sv(&re, csview_from(input), "$3.$2.$1;", 0, NULL, CREG_STRIP));
printf("strip: %s\n", cstr_str(&str));
/* Wrap all words in ${} */