From 76970da3554161582fb1fc8e3af459f3c5371a4d Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 21 Aug 2018 15:09:44 +0800 Subject: [PATCH] fix regex bug --- libs/line-message/commands/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/line-message/commands/index.js b/libs/line-message/commands/index.js index 5064721..cd991c7 100644 --- a/libs/line-message/commands/index.js +++ b/libs/line-message/commands/index.js @@ -73,6 +73,7 @@ const parseCMD = async (text = '', source = {}) => { let txt = '' console.log('obj ::: ', obj) for (let i of obj) { + i.key = i.key.replace(/(\+|\[|\]|\*|\$|\^|\(|\))/g, '\\$1') txt += (txt.length > 0 ? '|' : '') + i.key } regex = new RegExp(`^(${txt})$`)