Minor quirk with FreeBSD sed

Posted on

Tags: FreeBSD finding

While working on updating net-im/ejabberd port for FreeBSD, I came across a quirk of FreeBSD sed(1). It turns out when in BRE (basic regular expression mode), sed(1) always interprets | (pipe character) literally whether escaped, or not. I was thinking that it maybe a bug in FreeBSD implementation of sed(1), as GNU sed or grep interprets | as a regular expression operator when escaped in BRE mode. I was planning to report this as bug, but on careful RTFMing through re_format(7) manpage which sed(1) cites in its manpage:

Obsolete (``basic'') regular expressions differ in  several respects.  `|' is an ordinary character and there is no equivalent for its functionality.