On 2025-09-08 10:05, Michael Figiel via GNU coreutils Bug Reports wrote:
The expected behaviour is on FreeBSD and OpenBSD, so different code
base, but I think it's more consistent with the POSIX description of
expr.

My reading of POSIX is that the GNU behavior is required and the FreeBSD behavior is correct. Admittedly this is an obscure corner of the spec.

For what it's worth, GNU sed (and I assume other GNU programs) agree with GNU expr and with traditional (e.g., Solaris) expr:

$ echo /usr/local/lib/erlang28/bin:/sbin:/bin:/usr/sbin:/usr/bin | sed 's|\(.*:\)\{0,1\}/usr/local/lib/erlang28/bin\(:.*\)\{0,1\}|1=(\1) 2=(\2)|'
1=() 2=(:/sbin:/bin:/usr/sbin:/usr/bin)




Reply via email to