php mb_ereg()无法正常工作宽度阿拉伯语

mb_ereg() not working properly.

$badword ="ناك";  // which mean F***.

$TextToCheck = "في الكون هناك الكثير من الكواكب"; // In universe there's a lot of planets.

mb_ereg("\b".$badword."\b", $TextToCheck, $text);

echo $text[0]; // the output $text : ناك

which mean that the word ("هناك" = there) is found as "ناك" which mean that mb_ereg didn't get in count the first letter "ه" (هـ) "";

any way there's many other situation like this, any solution?

Use preg_match instead of mb_ereg function

$badword ="ناك";  // which mean ****.

$TextToCheck = "في الكون هناك الكثير من الكواكب"; // In universe there's a lot of planets.

preg_match("/".$badword."/", $TextToCheck, $text);

echo $text[0];