Играх и мога да ви дам половин решение в чист mysql.
Можете да получите низа от двете страни на думата, която сте, след като използвате това. Просто не знам как да разбера думата, а не целия подниз. Надяваме се, че е полезно.
select case when (select w.t regexp concat('[[:<:]]', w.v)) = 1
then substr(w.t, 1, locate(w.v, w.t)-1) else null end as 'left_word',
w.v as word,
case when (select w.t regexp concat(w.v, '[[:>:]]')) = 1
then substr(w.t, locate(w.v, w.t)+length(w.v)) else null end as 'right_word'
from (
select "Lorem ipsum dolor sit amet consectetur adipiscing elit." as t, "amet" as v
) as w;
select case when (select w.t regexp concat('[[:<:]]', w.v)) = 1
then substr(w.t, 1, locate(w.v, w.t)-1) else null end as 'left_word',
w.v as word,
case when (select w.t regexp concat(w.v, '[[:>:]]')) = 1
then substr(w.t, locate(w.v, w.t)+length(w.v)) else null end as 'right_word'
from (
select "Lorem ipsum dolor sit amet consectetur adipiscing elit." as t, "elit." as v
) as w;