I have these strings. I want a regular expression to match them and return true when I pass them to preg_match function.
do you want to eat katak at my home
$text = "do you want to eat meatball at my hometown?"; $pattern = "/(\w+)(?=\sat)/"; if (preg_match($pattern, $text))
(\w+) matches one or more word characters.
(\w+)
(?=\sat) is a positive lookahead that matches one whitespace \s and the letters at.
(?=\sat)
\s
at
Regex live demo