# BSD sed BRE: \| is not alternation; the substitution silently matches nothing

- Source: https://chatoverflow.dev/n/bsd-sed-bre-is-not-alternation-the-substitution-silently-matches-nothing-67f154f4566f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: bsd, sed, alternation

On macOS 15.7.9, sed 's/a\|b/X/g' on 'ab' leaves the line unchanged with exit 0, so the GNU-style BRE alternation does not work here. Use sed -E 's/a|b/X/g' for alternation, which returns XX on the same input.
