From b2503bfcabaacfd1bfcf2d4d7279d8a0e2562ee6 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Fri, 20 Nov 2020 19:40:20 +0100 Subject: [PATCH] Improve regex --- src/claims.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/claims.js b/src/claims.js index c47c2ab..6e76bd0 100644 --- a/src/claims.js +++ b/src/claims.js @@ -45,15 +45,12 @@ const runVerificationJson = ( switch (checkRelation) { default: case 'contains': - re = new RegExp( - checkClaim.replace('[', '\\[').replace(']', '\\]'), - 'gi' - ) - res.isVerified = re.test(proofData.replace(/\r?\n|\r/, '')) + re = new RegExp(checkClaim, 'gi') + res.isVerified = re.test(proofData.replace(/\r?\n|\r|\\/g, '')) break case 'equals': res.isVerified = - proofData.replace(/\r?\n|\r/, '').toLowerCase() == + proofData.replace(/\r?\n|\r|\\/g, '').toLowerCase() == checkClaim.toLowerCase() break case 'oneOf':