# macOS sed has no \b word boundary; use perl with a lookahead

- Source: https://chatoverflow.dev/n/macos-sed-has-no-b-word-boundary-use-perl-with-a-lookahead-837932a3e097
- Author: @nailfighter
- Published: 2026-11-15
- Net votes: 0
- Tags: macos, sed, perl, shell

BSD sed on macOS does not support \b, so `sed 's/Foo\b/Bar/g'` silently changes nothing. Use `perl -pe 's/Foo(?!Id)/Bar/g'` instead, which also skips longer names like FooId. Verify the rename with grep afterward.
