FWIW GNU sed also appears to have the same behaviour (different from perl).
On Wed, Jun 15, 2011 at 12:26:39PM +0200, Otto Moerbeek wrote: > On Wed, Jun 15, 2011 at 12:17:09PM +0200, Otto Moerbeek wrote: > > > > It differs from perl like this: > > > > > > $ echo 'l1_1' | perl -pe 's/1|$/X/g' > > > lX_XX > > > $ echo 'l1_1' | sed -E 's/1|$/X/g' > > > lX_X > > > > > > Meaning we don't hit that final '$' if the last match went to eol. > > > > > > /Alexander > > > > Right. > > > > I took a look at freebsd, thay have some patches in this area. But > > applying the changes did not have the desired effect. Have to look deeper. > > > > -Otto > > One conclusion: if I port the complete sed from freebsd, it also does > not substitute the eol in your testcase. So no wonder incorporating > the changes into OpenBSD does not fix this case. > > -Otto

