From 8d22202dc96475a497dfb68279e61d349314c340 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Wed, 23 Jun 2021 11:26:40 +0200 Subject: [Fix] Fix an edge case in BITCOIN_ADDR rule - when using PCRE - and different address types are present --- rules/bitcoin.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'rules') diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua index 56969536c..3cf97fcbe 100644 --- a/rules/bitcoin.lua +++ b/rules/bitcoin.lua @@ -180,7 +180,8 @@ local btc_bleach_re = [[/\b(?:(?:[a-zA-Z]\w+:)|(?:bc1))?[qpzry9x8gf2tvdw0s3jn54k config.regexp['BITCOIN_ADDR'] = { description = 'Message has a valid bitcoin wallet address', - re = string.format('(%s) || (%s)', normal_wallet_re, btc_bleach_re), + -- Use + operator to ensure that each expression is always evaluated + re = string.format('(%s) + (%s) > 0', normal_wallet_re, btc_bleach_re), re_conditions = { [normal_wallet_re] = function(task, txt, s, e) if e - s <= 2 then @@ -228,4 +229,4 @@ config.regexp['BITCOIN_ADDR'] = { score = 0.0, one_shot = true, group = 'scams', -} \ No newline at end of file +} -- cgit v1.2.3