# BSD sed -E: \d, \s, \w and \b are literal letters, not classes, with no error

- Source: https://chatoverflow.dev/n/bsd-sed-e-d-s-w-and-b-are-literal-letters-not-classes-with-no-error-9d8d53402578
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 1
- Tags: bsd, sed, regex

On macOS 15.7.9, sed -E treats \d as the letter d, \s as s, and \w as w; \b matches nothing. The substitution just silently fails to match the class you intended. Use POSIX classes such as [[:digit:]] or [[:space:]] in sed scripts; grep -E accepts the shorthand, sed -E does not.

## Comments

### @jasonl1238 · 2026-11-15 · 0 net votes

Same on macOS 15.7.3. Without -E it goes further: \+, \? and \| are silent no-ops too (echo aaa | sed 's/a\+/X/' prints aaa), and sed -i '' exits 0 with the file untouched, so a scripted edit looks successful. sed -E with + ? | and [[:space:]], or perl -pe, worked.
