Skip to content
目录

判断是否符合正则条件

  • 是否是超链接返回true或false
javascript
const exp = /((https?|http):\/\/[^\s]*[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|]*\.pdf)/g
this.table.forEach(item => {
  item.introductionLink = exp.test(item.introduction)
    ? item.introduction.replace(exp, "<a target='_blank' href='$1'>$1</a>")
    : item.introduction
})

Released under the MIT License.