Subject: bug#73598: Acknowledgement (bug in sed Invalid preceding regular expression)

From: Peter Smulders <[email-masked]>
Date: Fri, 11 Oct 2024 11:53:13 +0200

Some further observations regarding the behaviour of regular expressions 
in 'sed'

as noticed before  the following is not accepted

$ echo ****somestring | sed s/\*\*\*\*//
sed: -e expression #1, char 8: Invalid preceding regular expression

but the following does

$ echo ****somestring | sed s/\\*\\*\\*\\*//
somestring

However, even this does not work anymore if the command is surrounded by 
backquotes.

e.g.
$ name=`echo ****some string | sed s/\\*\\*\\*\\*//`
sed: -e expression #1, char 8: Invalid preceding regular expression

On the other hand the equivalent using $() is ok:
$ name=$(echo ****some string | sed s/\\*\\*\\*\\*//)
$ echo $name
some string

On 2-10-2024 16:50, Peter Smulders wrote:
> I think I know already what is the matter. For to work properly double 
> escapes are needed, i.e.
>
>  echo ****some string | sed s/\\*\\*\\*\\*//
>
> But I still find it strange ...
>
> On 2-10-2024 15:00, GNU bug Tracking System wrote:
>> Thank you for filing a new bug report with debbugs.gnu.org.
>>
>> This is an automatically generated reply to let you know your message
>> has been received.
>>
>> Your message is being forwarded to the package maintainers and other
>> interested parties for their attention; they will reply in due course.
>>
>> Your message has been sent to the package maintainer(s):
>> [email-masked]
>>
>> If you wish to submit further information on this problem, please
>> send it to [email-masked].
>>
>> Please do not send mail to [email-masked] unless you wish
>> to report a problem with the Bug-tracking system.
>>