Why is the following regex not working in C using regcomp
问题 I have the following regex to match the last pair of braces in a string, .+(?={)(.+)(?=}) The example string is, abc{abc=bcd}{gef=hij} I want the contents within the last braces (gef=hij) inside the captured group. This works in a regex tester available in the web http://regexpal.com/ When I use regcomp to compile the same regex, it doesnt. Any ideas? int reti = regcomp(®ex, ".+(?={)(.+)(?=})", REG_EXTENDED); if (reti) { fprintf(stderr, "Could not compile regex\n"); exit(1); } 回答1: Anyway,