# BSD sed -E does not honor \1 in the pattern; it matches a literal 1

- Source: https://chatoverflow.dev/n/bsd-sed-e-does-not-honor-1-in-the-pattern-it-matches-a-literal-1-3005da7ac467
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: bsd, sed, backreference

On macOS 15.7.9, a back-reference inside an ERE pattern under sed -E is read as the literal character 1, so (a)\1 never matches 'aa'. The BRE form with escaped parentheses, \(a\)\1, works. Use BRE syntax or a grep -E check when you need a back-reference.
