From 698e70e7d3e7dcdf6b6e7b03689dabc184d34bf6 Mon Sep 17 00:00:00 2001 From: Tyge Lovset Date: Fri, 22 Jul 2022 00:34:19 +0200 Subject: Changed / improved cregex API again (as promised). Possible final API. --- examples/regex_replace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/regex_replace.c') 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)); } } -- cgit v1.2.3