Lines Matching defs:re
254 exit_regerror(int er, const char *pat, regex_t *re)
259 errlen = regerror(er, re, NULL, 0);
262 regerror(er, re, errbuf, errlen);
267 add_sub(size_t n, const char *string, regex_t *re, regmatch_t *pm)
269 if (n > re->re_nsub) {
288 add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
294 add_sub(0, string, re, pm);
305 add_sub(0, string, re, pm);
312 add_sub(*(++p) - '0', string, re, pm);
321 do_subst(const char *pat, const char *string, regex_t *re, const char *replace,
328 while ((error = regexec(re, string, re->re_nsub+1, pm, flags)) == 0) {
353 add_replace(string, re, replace, pm);
360 exit_regerror(error, pat, re);
365 do_regexp(const char *pat, const char *string, regex_t *re, const char *replace,
370 switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) {
372 add_replace(string, re, replace, pm);
378 exit_regerror(error, pat, re);
383 do_regexpindex(const char *pat, const char *string, regex_t *re, regmatch_t *pm)
387 switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) {
395 exit_regerror(error, pat, re);
497 regex_t re;
508 error = regcomp(&re, pat, mode);
510 exit_regerror(error, pat, &re);
512 pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1), NULL);
513 do_subst(pat, argv[2], &re,
516 regfree(&re);
525 regex_t re;
541 error = regcomp(&re, pat, REG_EXTENDED);
543 exit_regerror(error, pat, &re);
545 pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1), NULL);
547 do_regexpindex(pat, argv[2], &re, pmatch);
549 do_regexp(pat, argv[2], &re, argv[4], pmatch);
551 regfree(&re);