正则收集器

  1. 匹配回复/nb@/nb:这种乱码字符,然
str.replace(/回复/nb@/nb:/ig, '')

  1. 匹配[文字]文字[文字]括号,希望分别得到文字里面的东西
let regex = /[.*?]/g
let arr= str.match(regex) // ['文字', '文字']

  1. 消除字符中的html
let val = val.replace(/<[^>]+>/g, '')
原文地址:https://www.cnblogs.com/mayufo/p/8622180.html