I want to replace an exact word using preg_replace by \b modifier as mentioned in this question.
But it seems that won’t work for Unicode characters such as Persian and Arabic. This example works:
preg_replace('/(\bto\b|\bis\b)/i', '', 'go to test if var is set using isset')
But this one won’t work:
preg_replace('/(\bاز\b|\bبه\b)/i', '', 'راه مدرسه به خونه از اونجا میگذره')
Is there a way to get the required result, splitting on word boundaries?
Got it myself, have to use
\umodifier simply as