Domanda

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 ?

È stato utile?

Soluzione

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);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top