标签: php regex
希望将#678#替换为:
#678#
<span id="note-678"></span>
答案 0 :(得分:6)
试试这个:
$str = preg_replace('/#(\d+)#/', '<span id="note-$1"></span>', $str);