This commit is contained in:
Jay 2018-08-21 22:49:33 +08:00
commit 8224c444c1

View File

@ -73,7 +73,8 @@ const parseCMD = async (text = '', source = {}) => {
let txt = ''
console.log('obj ::: ', obj)
for (let i of obj) {
txt += (txt.length > 0 ? '|' : '') + i.key
let key = i.key.replace(/(\+|\[|\]|\*|\$|\^|\(|\))/g, '\\$1')
txt += (txt.length > 0 ? '|' : '') + key
}
regex = new RegExp(`^(${txt})$`)
console.log(regex)