this has been bugging me for a couple years now.
"match this or that" works.
"match beginning of line" works.
"match end of line" works.
"match beginning of line or end of line", not so much.
All on MacOS.
echo "hello world" | sed -E 's/(h|d)/X/g'
Xello worlX
echo "hello world" | sed -E 's/(^)/X/g'
Xhello world
echo "hello world" | sed -E 's/($)/X/g'
hello worldX
echo "hello world" | sed -E 's/(^|$)/X/g'
Xhello world
Xhello worldX
on Debian.