From 11f67e03d3dd227432a15dcc4df51ccee1850f24 Mon Sep 17 00:00:00 2001 From: sarinniural <107876679+sarinniural@users.noreply.github.com> Date: Mon, 7 Nov 2022 23:26:44 -0600 Subject: [PATCH] Replace with the regex pattern match rather than the string for pattern --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index d0070ec..96885a4 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,7 @@ function getCardNumbers(message) { console.log(`getCardNumber(${message})`); console.log(`Trello ID match pattern ${trelloCardIdPattern}`) let ids = message && message.length > 0 ? message.replace(regexPullRequest, "").match(new RegExp(`${trelloCardIdPattern}\\d+`, 'g')) : []; - return ids && ids.length > 0 ? ids.map(x => x.replace(trelloCardIdPattern, '')) : null; + return ids && ids.length > 0 ? ids.map(x => x.replace(new RegExp(trelloCardIdPattern), '')) : null; } function getAllCardNumbers(message, branch) { @@ -179,4 +179,4 @@ async function run() { } }; -run() \ No newline at end of file +run()