: #678# ile değiştirmek isteyen
#678#
<span id="note-678"></span>
Bu deneyin:
$str = preg_replace('/#(\d+)#/', '<span id="note-$1"></span>', $str);