Command using sed

I have a problem. I want to change ole without changing dole in this file. I've tried to use:

sed -i s/^ole$/kari/ file.txt

Is there any way to change this without using two command lines as:

sed -i s/^ole/kari/ file.txt; sed -i s/ole$/kari/ file.txt

cat file.txt

ole duck
doffen duck
dole duck
duck, ole

Solution 1:

sed -e s'/\bole\b/kari/g' file.txt

\b boundary