GNU bug report logs -
#73598
bug in sed Invalid preceding regular expression
Previous Next
Full log
View this message in rfc822 format
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):
>> bug-sed <at> gnu.org
>>
>> If you wish to submit further information on this problem, please
>> send it to 73598 <at> debbugs.gnu.org.
>>
>> Please do not send mail to help-debbugs <at> gnu.org unless you wish
>> to report a problem with the Bug-tracking system.
>>
This bug report was last modified 247 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.