Fw: GNU sed: bug in repeated sub expression?
Bonzini
bonzini@gnu.org
Thu Mar 13 23:07:00 GMT 2003
Here is a bug report I received. I think it would be wise to add
this test and XFAIL it:
> The POSIX RE page is quite clear about the fact that, in cases
> like '\(a*\)*' the sub-expression (i.e. 'a*') is not allowed to match the
> null string UNLESS it is required to let the outer-expression to
> match at all, or to reach the minimum repetition count in cases like
> '\(a*\)\{3,5\}'.
>
> All this to say that, if I understand it correctly, the following
> expression:
> echo abcd | sed 's/\(a*\)*/<\&=&,\\1=\1>/'
> should give:
> <&=a;\1=a>bcd
> instead of what is currently produced by GNU sed 4.0.5:
> <&=a;\1=>bcd
> and similarly:
> echo aba,ab,a | sed 's/\(a*b*\)\{1,2\}/<\&=&,\\1=\1>/g'
> should give:
> <&=aba;\1=a>,<&=ab;\1=ab>,<&=a;\1=a>
> instead of what GNU sed currently yields.
Paolo
ps: Jakub, I'll release shortly 4.0.6 which has --with-included-regex
More information about the Libc-alpha
mailing list