1 // commit 7c8c86f6308c7e0816b9638465a5917b12159e8f 2015-03-20
2 // backref is not valid in ere
3 #include <regex.h>
4 #include "test.h"
5
main(void)6 int main(void)
7 {
8 char buf[200];
9 char pat[] = "(a)\\1";
10 regex_t r;
11 int n;
12
13 n = regcomp(&r, pat, REG_EXTENDED);
14 if (n) {
15 regerror(n, &r, buf, sizeof buf);
16 t_error("regcomp(%s) returned %d (%s) wanted 0\n", pat, n, buf);
17 }
18
19 n = regexec(&r, "aa", 0, 0, 0);
20 if (n != REG_NOMATCH) {
21 regerror(n, &r, buf, sizeof buf);
22 t_error("regexec(/%s/ ~ \"aa\") returned %d (%s), wanted REG_NOMATCH\n",
23 pat, n, buf);
24 }
25
26 n = regexec(&r, "a1", 0, 0, 0);
27 if (n) {
28 regerror(n, &r, buf, sizeof buf);
29 t_error("regexec(/%s/ ~ \"a1\") returned %d (%s), wanted 0\n",
30 pat, n, buf);
31 }
32
33 return t_status;
34 }
35