模糊查询
2019-08-01 本文已影响0人
吴一晏
const a = '你好' //用户输入的字符串
const regstr = [",...a,"].join('.*')
const reg = new RegExp(regstr)
console.log(reg.test('ni你hao好')) //待匹配的字符型
const a = '你好' //用户输入的字符串
const regstr = [",...a,"].join('.*')
const reg = new RegExp(regstr)
console.log(reg.test('ni你hao好')) //待匹配的字符型