I need to convert @mentions (nicknames) into clickable links: @mentions
This works fine:
preg_match_all("/\B@([a-zA-Z0-9-.]+(?!\/))\b/i", $text1, $matchesx);
but there is 1 problem. As you see, nicknames may contain only letters a-zA-Z, numbers 0-9, dots and -
This regex converts to links all words (first parts of words) that start with @ and letters or numbers even if the rest of the word contains other characters. For example:
@mentionsúñíá
must stay untauched because it contains characters úñíá
but this script converts it to:
@mentionsúñíá
Word bondary for some reason does not work. Can somebody help me to fix this problem?