Created attachment 12855 [details] test program illustrating the \b-inside-interval regex bug The glibc regular expression code mishandles extended regular expressions such as: (.*\band){2} although it correctly processes equivalent expressions such as: (.*(\<|\>)and){2} There is a similar problem with the same regular expression in BRE syntax: \(.*\band\)\{2\} To reproduce the problem, compile and run the attached file b-interval-bug.c. It will exit with status 1, whereas the correct exit status is 0. This bug was reported against GNU 'sed' here: https://bugs.gnu.org/41558 and the original posting is from StackExchange, here: https://unix.stackexchange.com/questions/579889/why-doesnt-this-sed-command-replace-the-3rd-to-last-and The original posting mentions backreferences but the bug occurs even without backreferences.