Hi,
> Right, and the same behavior is shown by all the seds I’ve seen (GNU,
> BSD, Busybox & Plan 9). Interestingly, both GNU and BSD ed give an
> error instead (for global substitution against a null-matching regex).
What is “BSD”? Are you talking about BSD 4.4?
OpenBSD's sed surely gives the same result as our sbase sed.
> Which behavior do you prefer?
That being said, I don't think that is the correct behaviour.
According to POSIX[1] (and if I understand correctly), matching the BRE
"G*" against "P" should match the null string, but not be a no match.
But in "glorious" there isn't an ethereal null string between each
character, so in addition to be an unexpected result it isn't correct to
get a replacement of "PgPlPoPrPiPoPuPsP".
I think we should just bail out with no modification, but no error
either. That last point may not be POLA, but when I think about it, that
makes sense to me.
Just my opinion though.
[1]
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_01
Received on Tue Jul 26 2016 - 10:22:48 CEST