diff --git a/shaarli2mastodon.php b/shaarli2mastodon.php index a51ab4c..5729c9e 100644 --- a/shaarli2mastodon.php +++ b/shaarli2mastodon.php @@ -307,5 +307,9 @@ function isLinkNote($link){ * @return string The tag modified to be valid. */ function tagify($tag){ - return '#' . preg_replace('/[^0-9a-zA-Z]/m', '', $tag); -} \ No newline at end of file + // Regex inspired by https://gist.github.com/janogarcia/3946583 + // TODO validate real hashtag rules + // - only UTF-8 characters plus underscore + // - must not contain only numbers. At least one alpha character or underscore + return '#' . preg_replace('/[^0-9_\p{L}]/u', '', $tag); +}