piighost/btc-address

Bitcoin address in the three live encodings: legacy P2PKH starting with 1, P2SH starting with 3, both over the Base58 alphabet that drops zero, capital O, capital I and lowercase l, and bech32 SegWit starting with bc1. The Base58 branch is the noisy one, plenty of opaque identifiers of twenty-six to thirty-five characters happen to start with 1 or 3 and match. The bech32 branch is far more precise thanks to its prefix, so ship bc1 alone if false positives matter. No collision with any existing pattern.

Label: BTC_ADDRESS

Pattern

\b(?:[13][1-9A-HJ-NP-Za-km-z]{25,34}|bc1[02-9ac-hj-np-z]{11,71})\b

Must be caught

Must be left alone

Tags: international, identity, finance

Download the detector as TOML