我想使用相同的哈希标签替换字符串中的哈希标签,但在添加链接之后
例:
$text = "any word here related to #English must #be replaced."
#English ---> <a href="bla bla">#English</a> #be ---> <a href="bla bla">#be</a>
所以outpu应该是这样的:
$text = "any word here related to <a href="bla bla">#English</a> must <a href="bla bla">#be</a> replaced."
谢谢
$input_lines="any word here related to #English must #be replaced."; preg_replace("/(#\w+)/","<a href='bla bla'>$1</a>",$input_lines);
OUTPUT:
any word here related to <a href='bla bla'>#English</a> must <a href='bla bla'>#be</a> replaced.