Re: Possible omission from documentation regarding MacOS/BSD /usr/bin/sed

Paul Eggert <[email protected]> Sat, 30 Aug 2025 18:24:09 -0700
Newsgroups gmane.comp.sysutils.autoconf.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 2025-08-30 18:16, Collin Funk wrote:
>> In the normal case when @option{-E} is not used,
>> +portable @command{sed} regular expressions should use @samp{\} only to escape
>> +characters in the string @samp{$*.123456789[\^n}.  For example,
>> +POSIX.1-2024 says it is implementation-defined
>> +whether @samp{\|} means alternation or simply matches @samp{|},
>> +so it should be avoided in portable scripts.
> Shouldn't '&' also be added to that list of characters?

No, '&' stands for itself in REs. The substitution string (which is what 
you're thinking of) is not an RE, and is covered in the next paragraph.