Open guanpengchn opened 4 years ago
匹配出markdown中不包含mp.weixin.qq.com的链接表达式,其中每次只匹配一个,同时要考虑不能匹配到图片表达式
mp.weixin.qq.com
const a = /^((?!!).)*\[\S*\]\(((?!mp.weixin.qq.com)[\w:/.#])*\)/i const b = '[前端硬核面试专题之 CSS 55 问](https://mp.weixin.qq.com/s/SVKMsQtOLNqYXeT_f95FUw)' const c = ' [前端s](https://sdf.com/s/SVKMsQtOLNqYXeT_f95FUw)' const d = '[前端t](#/s/SVKMsQtOLNqYXeT_f95FUw) [前端t](#/s/SVKMsQtOLNqYXeT_f95FUw)' const e = '![sdfsf](sfsfsdf)' console.log(b.match(a)) console.log(c.match(a)) console.log(d.match(a)) console.log(e.match(a))
匹配出markdown中不包含
mp.weixin.qq.com
的链接表达式,其中每次只匹配一个,同时要考虑不能匹配到图片表达式