diff options
| -rw-r--r-- | docs/cregex_api.md | 6 | ||||
| -rw-r--r-- | examples/regex_replace.c | 6 | ||||
| -rw-r--r-- | include/stc/cregex.h | 6 | ||||
| -rw-r--r-- | src/cregex.c | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/docs/cregex_api.md b/docs/cregex_api.md index 34278905..43ad1f41 100644 --- a/docs/cregex_api.md +++ b/docs/cregex_api.md @@ -35,7 +35,7 @@ int cregex_captures(const cregex* self); int cregex_find(const char* input, const cregex* re, csview match[], int mflags); int cregex_find_sv(csview input, const cregex* re, csview match[]); // takes string pattern instead of re. (for one-time matches) -int cregex_find_p(const char* input, const char* pattern, csview match[], int cmflags); +int cregex_find_pt(const char* input, const char* pattern, csview match[], int cmflags); bool cregex_is_match(const char* input, const cregex* re); @@ -43,7 +43,7 @@ cstr cregex_replace(const char* input, const cregex* re, const char* repl cstr cregex_replace_ex(const char* input, const cregex* re, const char* replace, unsigned count, int rflags, bool (*mfun)(int grp, csview match, cstr* mstr)); // takes string pattern instead of re -cstr cregex_replace_p(const char* input, const char* pattern, const char* replace, unsigned count); +cstr cregex_replace_pt(const char* input, const char* pattern, const char* replace, unsigned count); cstr cregex_replace_pe(const char* input, const char* pattern, const char* replace, unsigned count, int crflags, bool (*mfun)(int grp, csview match, cstr* mstr)); @@ -118,7 +118,7 @@ int main() { For a single match you may use the all-in-one function: ```c -if (cregex_find_p(input, pattern, match, 0)) +if (cregex_find_pt(input, pattern, match, 0)) printf("Found date: %.*s\n", c_ARGsv(match[0])); ``` diff --git a/examples/regex_replace.c b/examples/regex_replace.c index eba31491..1b140676 100644 --- a/examples/regex_replace.c +++ b/examples/regex_replace.c @@ -22,7 +22,7 @@ int main() printf("INPUT: %s\n", input); /* replace with a fixed string, extended all-in-one call: */ - cstr_take(&str, cregex_replace_p(input, pattern, "YYYY-MM-DD", 0)); + cstr_take(&str, cregex_replace_pt(input, pattern, "YYYY-MM-DD", 0)); printf("fixed: %s\n", cstr_str(&str)); /* US date format, and add 10 years to dates: */ @@ -30,7 +30,7 @@ int main() printf("us+10: %s\n", cstr_str(&str)); /* Wrap first date inside []: */ - cstr_take(&str, cregex_replace_p(input, pattern, "[$0]", 1)); + cstr_take(&str, cregex_replace_pt(input, pattern, "[$0]", 1)); printf("brack: %s\n", cstr_str(&str)); /* Shows how to compile RE separately */ @@ -47,7 +47,7 @@ int main() } /* Wrap all words in ${} */ - cstr_take(&str, cregex_replace_p("[52] apples and [31] mangoes", "[a-z]+", "$${$0}", 0)); + cstr_take(&str, cregex_replace_pt("[52] apples and [31] mangoes", "[a-z]+", "$${$0}", 0)); printf("curly: %s\n", cstr_str(&str)); } } diff --git a/include/stc/cregex.h b/include/stc/cregex.h index 7c4d0a4c..d19d518f 100644 --- a/include/stc/cregex.h +++ b/include/stc/cregex.h @@ -108,8 +108,8 @@ int cregex_find_sv(csview input, const cregex* re, csview match[]) { } /* match + compile RE pattern */ -int cregex_find_p(const char* input, const char* pattern, - csview match[], int cmflags); +int cregex_find_pt(const char* input, const char* pattern, + csview match[], int cmflags); static inline bool cregex_is_match(const char* input, const cregex* re) @@ -126,7 +126,7 @@ cstr cregex_replace(const char* input, const cregex* re, const char* replace, un cstr cregex_replace_pe(const char* input, const char* pattern, const char* replace, unsigned count, int crflags, bool (*mfun)(int i, csview match, cstr* mstr)); static inline -cstr cregex_replace_p(const char* input, const char* pattern, const char* replace, unsigned count) +cstr cregex_replace_pt(const char* input, const char* pattern, const char* replace, unsigned count) { return cregex_replace_pe(input, pattern, replace, count, 0, NULL); } /* destroy regex */ diff --git a/src/cregex.c b/src/cregex.c index d1f9c133..690c9ad5 100644 --- a/src/cregex.c +++ b/src/cregex.c @@ -1218,8 +1218,8 @@ cregex_find(const char* input, const cregex* re, } } -int cregex_find_p(const char* input, const char* pattern, - csview match[], int cmflags) { +int cregex_find_pt(const char* input, const char* pattern, + csview match[], int cmflags) { cregex re = cregex_init(); int res = cregex_compile(&re, pattern, cmflags); if (res != cre_success) return res; |
