2008/12/31 Paolo Bonzini <bonz...@gnu.org>: > thomas wrote: >> 2008/12/30 Paolo Bonzini <bonz...@gnu.org>: >>>> I don't think so, because the bug does not happen with sed from the >>>> heirloom toolchest. >>> It probably implements its own regex matcher instead of using libc's. >> >> Maybe. But two other GNU programs which probably use libc's regex >> matcher, bash and grep, do not behave like sed. > > bash does not implement regular expressions, only glob patterns. grep > uses libc's regex matcher only for regexes that include backreferences.
Thanks for your reply Paolo. I am not sure where the problem is, but I can see that grep and sed behave differently, even when the regexp contains backreferences. ~$ sed -rn '/([^a-z])\1/p' <<< a˚˚b ~$ egrep '([^a-z])\1' <<< a˚˚b a˚˚b Something is strange: sed behaves correctly when the pattern begins with an usual character. Look at this: ~$ sed 's/a[^a-z]/ax/g' <<< a˚b # correct axb ~$ sed 's/[^a-z]/x/g' <<< a˚b # wrong a˚b I hope this last example helps.