commit 9216f3f: [Minor] Slight regexp and capture improvements

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Jul 30 12:14:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-07-30 13:13:26 +0100
URL: https://github.com/rspamd/rspamd/commit/9216f3f02d1b9a5bce623f3d0b0b45149015ae05 (HEAD -> master)

[Minor] Slight regexp and capture improvements

---
 rules/bitcoin.lua | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua
index 406f4afa9..c14a84dc2 100644
--- a/rules/bitcoin.lua
+++ b/rules/bitcoin.lua
@@ -176,7 +176,7 @@ local function is_segwit_bech32_address(task, word)
 end
 
 local normal_wallet_re = [[/\b[13LM][1-9A-Za-z]{25,34}\b/AL{sa_body}]]
-local btc_bleach_re = [[/\b(?:\w+:)?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}\b/AL{sa_body}]]
+local btc_bleach_re = [[/\b(?:[a-zA-Z]\w+:)?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}\b/AL{sa_body}]]
 
 config.regexp['BITCOIN_ADDR'] = {
   description = 'Message has a valid bitcoin wallet address',
@@ -187,7 +187,7 @@ config.regexp['BITCOIN_ADDR'] = {
         return false
       end
 
-      local word = lua_util.str_trim(txt:sub(s, e))
+      local word = lua_util.str_trim(txt:sub(s + 1, e))
       local valid = is_traditional_btc_address(word)
 
       if valid then
@@ -208,7 +208,7 @@ config.regexp['BITCOIN_ADDR'] = {
         return false
       end
 
-      local word = tostring(lua_util.str_trim(txt:sub(s, e)))
+      local word = tostring(lua_util.str_trim(txt:sub(s + 1, e)))
       local valid = is_segwit_bech32_address(task, word)
 
       if valid then


More information about the Commits mailing list