summaryrefslogtreecommitdiffhomepage
path: root/examples/regex_replace.c
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-07-22 00:34:19 +0200
committerTyge Lovset <[email protected]>2022-07-22 00:34:19 +0200
commit698e70e7d3e7dcdf6b6e7b03689dabc184d34bf6 (patch)
tree21e7619432ded4b4db2b0dc06cfc88c565a038e7 /examples/regex_replace.c
parentf1bc406edb6faef3420de7f77a6f1246065861d9 (diff)
downloadSTC-modified-698e70e7d3e7dcdf6b6e7b03689dabc184d34bf6.tar.gz
STC-modified-698e70e7d3e7dcdf6b6e7b03689dabc184d34bf6.zip
Changed / improved cregex API again (as promised). Possible final API.
Diffstat (limited to 'examples/regex_replace.c')
-rw-r--r--examples/regex_replace.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/regex_replace.c b/examples/regex_replace.c
index ff4b4a6a..d57dede8 100644
--- a/examples/regex_replace.c
+++ b/examples/regex_replace.c
@@ -21,23 +21,23 @@ int main()
{
printf("input: %s\n", input);
/* European date format */
- cstr_take(&str, cregex_replace(input, pattern, "\\3.\\2.\\1"));
+ cstr_take(&str, cregex_replace_pat(input, pattern, "\\3.\\2.\\1"));
printf("euros: %s\n", cstr_str(&str));
/* US date format, and subtract 20 years: */
- cstr_take(&str, cregex_replace_ex(input, pattern, "\\1/\\3/\\2", sub_20y, 0, 0));
+ cstr_take(&str, cregex_replace_patx(input, pattern, "\\1/\\3/\\2", sub_20y, 0, 0));
printf("us-20: %s\n", cstr_str(&str));
/* replace with a fixed string: */
- cstr_take(&str, cregex_replace(input, pattern, "YYYY-MM-DD"));
+ cstr_take(&str, cregex_replace_pat(input, pattern, "YYYY-MM-DD"));
printf("fixed: %s\n", cstr_str(&str));
/* Wrap first date inside []: */
- cstr_take(&str, cregex_replace_ex(input, pattern, "[\\0]", NULL, 0, 1));
+ cstr_take(&str, cregex_replace_patx(input, pattern, "[\\0]", NULL, 1, 0));
printf("brack: %s\n", cstr_str(&str));
/* Wrap all words in {} */
- cstr_take(&str, cregex_replace("[52] apples and [31] mangoes", "[a-z]+", "{\\0}"));
+ cstr_take(&str, cregex_replace_pat("[52] apples and [31] mangoes", "[a-z]+", "{\\0}"));
printf("curly: %s\n", cstr_str(&str));
}
}