I've made my own PHP script and my problem with hashtags

and I've added preg_replace function to replace tags to hashtags its working well when i use English charsets but in Arabic or any other language its not working

where is the problem in my code ?

$post = @preg_replace('/(^|\s)#(\w+)/', '<a class=\"hashtag\" href="hashtag.php?tag=\2">\1#\2</a>', $post);

i want preg_repalce to replace none english tags too how ?

有帮助吗?

解决方案

i found it

this is how to match arabic hastags

$post = @preg_replace('/(#\w+)/u', '<a class="hashtag" href="hashtag.php?tag=\1">\1</a>', $post);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top