I have a problem with this script below the function it does is find the pads or # the Hashtag
of a message the problem is that it does not recognize the text Latin A - UTF-8
, I want it to work but I do not know how to make the script or what function to use.
#ŞŞŞ no funciona este tipo de texto
#SSS pero esta si
Example of the script:
function Hashtags($str)
{
// Match the hashtags
preg_match_all('/(^|[^a-z0-9_])#([a-z0-9_]+)/i', $str, $matchedHashtags);
$hashtag = '';
// For each hashtag, strip all characters but alnum
if(!empty($matchedHashtags[0])) {
foreach($matchedHashtags[0] as $match) {
$hashtag .= preg_replace("/[^a-z0-9]+/i", "", $match).',';
}
}
//to remove last comma in a string
return rtrim ($hashtag, ',');
}