ミス
regex.replace("あ","&#(\d+);","chr("$1"))