1*9ff1f2acSchristos #include <sys/types.h>
2*9ff1f2acSchristos #include <stddef.h>
3*9ff1f2acSchristos #include <regex.h>
4*9ff1f2acSchristos
5*9ff1f2acSchristos int
main(void)6*9ff1f2acSchristos main(void)
7*9ff1f2acSchristos {
8*9ff1f2acSchristos regex_t re;
9*9ff1f2acSchristos
10*9ff1f2acSchristos if (regcomp(&re, "\\<word\\>", REG_EXTENDED | REG_NOSUB))
11*9ff1f2acSchristos return 1;
12*9ff1f2acSchristos if (regexec(&re, "the word is here", 0, NULL, 0))
13*9ff1f2acSchristos return 2;
14*9ff1f2acSchristos if (regexec(&re, "same word", 0, NULL, 0))
15*9ff1f2acSchristos return 3;
16*9ff1f2acSchristos if (regexec(&re, "word again", 0, NULL, 0))
17*9ff1f2acSchristos return 4;
18*9ff1f2acSchristos if (regexec(&re, "word", 0, NULL, 0))
19*9ff1f2acSchristos return 5;
20*9ff1f2acSchristos if (regexec(&re, "wordy", 0, NULL, 0) != REG_NOMATCH)
21*9ff1f2acSchristos return 6;
22*9ff1f2acSchristos if (regexec(&re, "sword", 0, NULL, 0) != REG_NOMATCH)
23*9ff1f2acSchristos return 7;
24*9ff1f2acSchristos if (regexec(&re, "reworded", 0, NULL, 0) != REG_NOMATCH)
25*9ff1f2acSchristos return 8;
26*9ff1f2acSchristos return 0;
27*9ff1f2acSchristos }
28