1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
| #include <stddef.h> | #include <regex.h> | #include <tre-config.h> | int main(int argc, char *argv[]) | { | void* value = malloc(256); | regex_t preg = {.re_nsub = 4, .value = value}; | char const string [] = { | 'A', | 'B', | 'C', | 'D', | '\0'}; | regmatch_t pmatch = {.rm_so = 1, .rm_eo = 2}; | regamatch_t match = { | .nmatch = 4, | .pmatch = &pmatch, | .cost = 3, | .num_ins = 4, | .num_del = 5, | .num_subst = 6}; | regaparams_t params = { | .cost_ins = 7, | .cost_del = 8, | .cost_subst = 9, | .max_cost = 10, | .max_ins = 11, | .max_del = 1, | .max_subst = 2, | .max_err = 3}; | reganexec( | &preg, | string, | 4, | &match, | params, | 0); //target call | return 0; | } |
|