Reversing the line overcomes the limitation of expr to matching strings from the start of the line:-
r=$(echo "now is the the time" | rev) # Gives "emit eht eht si won"
p=$(expr match "$r" ".*\beht\b")
if [ $p -eq 0 ];then
expr length "$r" + 1 - $p
Using sed is better:-
expr length "$(echo "now is the the time" | sed -n 's/\bthe\b.*/t/p')"
The first 'the' to the end of the line is replaced with 't'.
\b represents a word boundary (to avoid matches with words like 'then')
-n is so that 0 is returned if there isn't a 'the' in the line.
EDIT: A shorter version of the first method
r=$(echo "now is the the time" | rev)
expr length match "$r" ".*\beh\(t\b.*\)"