In Php i wish to develop hashtag system with multi-language, For that i will use regular expression mechanism, for hash tag split and replace text with hyperlink.
First phase hash match will work for the given code
$str = '#????? ?????????? #??????';
preg_match_all('/#[^s#]*/i', $str, $mat);
$mat array has all hash tags in a input string like array([0]-#?????,[1] -#?????? )
Second phase replace hash tag with hyperlink given empty result for regular expression replace function like below
$str = '#?????,#??????';
$expression = "/#[^s#]*/i";
$string = preg_replace($expression, '<a href="https://www.example.com/hash_tag?tag=$1">$0</a>', $str);
my expected result is
#????? ??????????
#??????
how to fix this regular expression replace condition ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…