diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-03-11 12:55:34 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-03 13:13:26 +0200 |
| commit | 1ea9a99cf9872166cdf3b0aad93ee4896021e4f6 (patch) | |
| tree | b9318f965ff86f4fc2b9131b63c1f1e7fd273ed3 /text-regex.c | |
| parent | ba23d97ef69e9c913775d037b58beb66b5b1384c (diff) | |
| download | vis-1ea9a99cf9872166cdf3b0aad93ee4896021e4f6.tar.gz vis-1ea9a99cf9872166cdf3b0aad93ee4896021e4f6.tar.xz | |
text-regex: introduce function to match arbitrary text
Diffstat (limited to 'text-regex.c')
| -rw-r--r-- | text-regex.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/text-regex.c b/text-regex.c index c3d1cb2..640ead5 100644 --- a/text-regex.c +++ b/text-regex.c @@ -30,6 +30,10 @@ void text_regex_free(Regex *r) { free(r); } +int text_regex_match(Regex *r, const char *data, int eflags) { + return regexec(&r->regex, data, 0, NULL, eflags); +} + int text_search_range_forward(Text *txt, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags) { char *buf = text_bytes_alloc0(txt, pos, len); if (!buf) |
