Pattern: Bitcoin address

“Bitcoin address” is one of the patterns that you can select on the Match panel. Use this pattern to make a field match a Bitcoin address. You can select which types of Bitcoin addresses the pattern should allow.

P2PKH 1…

Turn on to allow Pay-to-Public-Key-Hash addresses in the form of 12higDjoCCNXSA95xZMWUdPvXNmkAduhWv that start with the digit 1 and are between 26 and 34 characters long, using a mixture of digits (except 0), uppercase letters (except O and I), and lowercase letters (except l).

P2SH 3…

Turn on to allow Pay-to-Script-Hash addresses in the form of 342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey that start with the digit 3 and are 34 characters long, using a mixture of digits (except 0), uppercase letters (except O and I), and lowercase letters (except l).

P2WPKH bc1q…

Turn on to allow Pay-to-Witness-Public-Key-Hash addresses in the form of bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c that start with bc1q and are 42 characters long. After the bc1q prefix they use a mixture of digits (except 1) and letters (except b, o, and i). You can choose whether to allow uppercase letters or lowercase letters.

P2WSH bc1q…

Turn on to allow Pay-to-Witness-Script-Hash addresses in the form of bc1qeklep85ntjz4605drds6aww9u0qr46qzrv5xswd35uhjuj8ahfcqgf6hak that start with bc1q and are 62 characters long. After the bc1q prefix they use a mixture of digits (except 1) and letters (except b, o, and i). You can choose whether to allow uppercase letters or lowercase letters.

P2TR bc1p…

Turn on to allow Pay-to-Taproot addresses in the form of bc1pxwww0ct9ue7e8tdnlmug5m2tamfn7q06sahstg39ys4c9f3340qqxrdu9k that start with bc1p and are 62 characters long. After the bc1p prefix they use a mixture of digits (except 1) and letters (except b, o, and i). You can choose whether to allow uppercase letters or lowercase letters.

Uppercase

Check to allow Segwit BC1Q… and Taproot BC1P… addresses using all uppercase letters. Though these addresses normally use only lowercase letters (and digits), strictly speaking they are case insensitive. When formatted as a QR code they are typically represented using only uppercase letters as that allows for a more compact QR format to be used.

If you allow both uppercase and lowercase addresses then the pattern still requires the whole address to be all-lowercase or all-uppercase when the field validation mode is set to “average” or “strict”. Mixed case addresses will be allowed if the mode is set to “none” or “loose”.

This setting does not apply to legacy P2PKH 1… and P2SH 3… addresses because the base58 encoding that they use is case sensitive.

Lowercase

Check to allow Segwit bc1q… and Taproot bc1p… addresses using all lowercase letters, which is how they are normally presented.

Even though these addresses are, strictly speaking, case insensitive, this pattern still requires the whole address to be all-lowercase or all-uppercase if you allow both uppercase and lowercase addresses when the field validation mode is set to “average” or “strict”. Mixed case addresses are allowed if the mode is set to “none” or “loose”.

This setting does not apply to legacy P2PKH 1… and P2SH 3… addresses because the base58 encoding that they use is case sensitive.

Examples