summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cregex.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-07-30 10:37:50 +0200
committerTyge Løvset <[email protected]>2022-07-30 10:37:50 +0200
commit90b4371d8a36ab609c2200289634c171a19f7fff (patch)
tree0db596e22fe671ad6f55dfde427a92eed9941c2a /include/stc/cregex.h
parent8329299b810b20cb90c2e3aa7ea465dcefa162aa (diff)
downloadSTC-modified-90b4371d8a36ab609c2200289634c171a19f7fff.tar.gz
STC-modified-90b4371d8a36ab609c2200289634c171a19f7fff.zip
Added support for more than 9 capture group replacements, e.g. "$12;". Added an inline function cregex_find_sv().
Diffstat (limited to 'include/stc/cregex.h')
-rw-r--r--include/stc/cregex.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/stc/cregex.h b/include/stc/cregex.h
index 4247197c..8f6464d4 100644
--- a/include/stc/cregex.h
+++ b/include/stc/cregex.h
@@ -94,6 +94,11 @@ int cregex_captures(const cregex* self);
/* return 1 on match, 0 on nomatch, and -1 on failure. */
int cregex_find(const char* input, const cregex* re,
csview match[], int mflags);
+static inline
+int cregex_find_sv(csview input, const cregex* re, csview match[]) {
+ match[0] = input;
+ return cregex_find(input.str, re, match, cre_m_startend);
+}
/* match + compile RE pattern */
int cregex_find_p(const char* input, const char* pattern,