I'm using regex to find a word or some words in a string. For example:
if(preg_match("~\bbet\b~",$text) !== false) // want to find "bet" in string
Mean i want to check if it there is bet in that string ($text)
But, if $text = "there is difference between this string and that string", it will return true.
Now, i want, for example these will return true:
$text = "I bet he's a virgin!"
$text = "Bet you're glad you flew out there."
But this sentence will return false
$text = "there is difference between this string and that string"
Or 1 more example for harder string:
I want to find "hi" in string But not hi in this
It will return true if
$text = "hi";
But return false if
$text = "this";