这样没结果vars='hi\nabc454def';console.log(/h.+(\d+)def/g.exec(s));这样是有结果的vars='hiabc454def';console.log(/h.+(\d+)def/g.exec(s));
2 回答
PIPIONE
TA贡献1829条经验 获得超9个赞
vars='hi\nabc454def';console.log(/h[\s\S]+(\d+)def/g.exec(s));//["hi↵abc454def","4",index:0,input:"hi↵abc454def"]console.log(/h[\w\W]+(\d+)def/g.exec(s));//["hi↵abc454def","4",index:0,input:"hi↵abc454def"]
添加回答
举报
0/150
提交
取消