I'm sorry, I might be confused, but if you're using a Python regex command, \y is not a word boundary. Instead, you're using the literal "y" letter to match your word. You should use \b for a word boundary. The correct regex syntax should look like the following:
select 'apple.' ~ '\bapple\b'
made with regex101