1// \0 is not a valid backref, it is undefined by the standard 2// we treat such cases as literal char 3#include <regex.h> 4#include "test.h" 5 6int main(void) 7{ 8 char buf[200]; 9 char pat[] = "a\\0"; 10 regex_t r; 11 int n; 12 13 n = regcomp(&r, pat, 0); 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 n = regexec(&r, "a0", 0, 0, 0); 19 if (n) { 20 regerror(n, &r, buf, sizeof buf); 21 t_error("regexec(/%s/ ~ \"a0\") returned %d (%s), wanted 0\n", 22 pat, n, buf); 23 } 24 25 return t_status; 26} 27