diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-30 13:13:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-30 13:13:26 +0100 |
commit | 9216f3f02d1b9a5bce623f3d0b0b45149015ae05 (patch) | |
tree | 084faed8900fc08a0542f2339ab8ee186527c9eb /rules/bitcoin.lua | |
parent | 0c9f4a5dceba9a8ecd8a359826518ed30e124595 (diff) | |
download | rspamd-9216f3f02d1b9a5bce623f3d0b0b45149015ae05.tar.gz rspamd-9216f3f02d1b9a5bce623f3d0b0b45149015ae05.zip |
[Minor] Slight regexp and capture improvements
Diffstat (limited to 'rules/bitcoin.lua')
-rw-r--r-- | rules/bitcoin.lua | 6 |
1 files 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 |