Hello,

Indeed there is a small problem:

# echo 'abbbbbbbbbbbbbfffff' | sed -E 's/[a$]/x/g'
xbbbbbbbbbbbbbfffff
# echo 'abbbbbbbbbbbbbfffff' | sed -E 's/a|$/x/g'
x

String modification is done inside the 'case 0:'
substitute(struct s_command *cp) in src/usr.bin/process.c

But the problem may comme from regexec_e.

Maybe openbsd devs should test another regexp code version ?

Hope it helps,
Who still use sed anyway :)

Regards.

2011/6/12 Ingo Schwarze <schwa...@usta.de>

> Hi Nils,
>
> Nils Anspach wrote on Sun, Jun 12, 2011 at 12:49:42PM +0200:
>
> > I have an issue with sed. Why does
> >
> >       echo 'ab' | sed -E 's/a|$/x/g'
> >
> > give 'x' whereas
>
> I sense a bug here.
> Tracing a bit around process(),
> it looks like the first application of the s command
> yields dst = "x" continue_to_process = "b\n",
> and then the second application
> appends "\n" to dst (should rather append "b", i think).
> Maybe something is wrong here with character/pointer counting,
> but i'm somewhat out of time now for tracing.
>
> This is worth more investigation.
>
> Yours,
>   Ingo
>
>


-- 
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\

Reply via email to