Subject: bug#73598: bug in sed Invalid preceding regular expression

From: Peter Smulders <[email-masked]>
Date: Wed, 2 Oct 2024 11:59:09 +0200

I expect the command line

echo ****some string | sed s/\*\*\*\*//

to strip the *'s and result in

some string

However I get the error message:

sed: -e expression #1, char 8: Invalid preceding regular expression

-----

When the sed command is taken from a file it works as expected:

$ echo ****some string | sed -f script
some string

where file script consists of the line
s/\*\*\*\*//

---

The problem shows in:

$ sed --version
sed (GNU sed) 4.9
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.

This sed program was built without SELinux support.

GNU sed home page: <https://www.gnu.org/software/sed/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email-masked]>.

----

an older version does not have this problem ( GNU sed version 3.02 )

best regards, Peter Smulders