SOURCE

let test = `
    #1 js,100元 #
    #12 java,1000元 #
    #sds dsdjsi # ddw
    #6 php,120元 #
`
let handler = test.match(/#\d+\s+.+\s+#$/gm);
handler = handler.map((item)=>{
    let h = item.replace(/#/,'').replace(/\s+#/,'').split(',');
    [name,price] = h;
    return {name,price};
})
console.log(handler);
console 命令行工具 X clear

                    
>
console