Match Crypto Wallet Addresses

The following information is provided on how to properly check the wallet address entered in the withdrawal form. In order to avoid receiving failed withdrawal requests, the merchant should check the wallet format of the selected currency. For example, you specified a Tron wallet address in the field, but the currency you selected for withdrawal is from the BNB chain network.

The following regular expressions are crafted to match some commonly used cryptocurrency wallet address types. This page details the Regex components and pattern tests to match Ethereum, Bitcoin, Dash, Tron, Dogecoin, Litecoin and Solana addresses.

Regular Expressions

Ethereum (ETH)

/^0x[a-fA-F0-9]{40}$/g

Bitcoin (BTC)

/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/g
/^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/g

Dash (DASH)

/X[1-9A-HJ-NP-Za-km-z]{33}$/g

Tron (TRX)

/T[A-Za-z1-9]{33}

Dogecoin (DOGE)

/^D{1}[5-9A-HJ-NP-U]{1}[1-9A-HJ-NP-Za-km-z]{32}$

Litecoin (LTC)

/^([LM3]{1}[a-km-zA-HJ-NP-Z1-9]{26,33}||ltc1[a-z0-9]{39,59})$/

Solana (SOL)

/^[1-9A-HJ-NP-Za-km-z]{32,44}$

Regex Components

Anchors

/

Open. Indicates the start of a regular expression.

^

Beginning. Matches the beginning of the string, or the beginning of a line if the multiline flag (m) is enabled.

$

End. Matches the end of the string, or the end of a line if the multiline flag (m) is enabled.

/

Close. Second "/" indicates the end of a regular expression and the start of expression flags.

Quantifiers

{40}

Ethereum (ETH): Match 40 of the preceeding token.

{25,34}

Bitcoin (BTC): Match between 25 and 34 of the preceeding token.

{33}

Dash (DASH): Match between 33 of the preceeding token.

{33}

Tron (TRX): Match between 33 of the preceeding token.

{32}

Dogecoin (DOGE): Match between 32 of the preceeding token.

{39,59}

Litecoin (LTC): Match between 39 and 59 of the preceeding token.

{32,44}

Solana (SOL): Match between 32 and 44 of the preceeding token.

OR Operator

|

Alternation acts like a boolean OR. Matches the expression before or after the "|".

Character Classes

Ethereum (ETH):

0

Character. Matches a "0" character (char code 48).

x

Character. Matches a "x" character (char code 120). Case sensitive.

[a-fA-F0-9]

Character Set. Match any character in the set. a-f Range matches a character in the range "a" to "f" (char code 97 to 102). Case sensitive. A-F Range matches a character in the range "A" to "F" (char code 65 to 70). Case sensitive. 0-9 matches a character in the range of "0" to "9" (char code 48 to 57). Case sensitive.

Bitcoin (BTC):

[a-zA-HJ-NP-Z0-9]

Character set. Match any character in the set. a-z Range matches a character in the range "a" to "z" (char code 97 to 122). Case sensitive. A-H Range matches a character in the range "A" to "H" (char code 65 to 72). Case sensitive. J-N Range matches a character in the range "J" to "N" (char code 74 to 78). Case sensitive. P-Z Range matches a character in the range "P" to "Z" (char code 80 to 90). Case sensitive. 0-9 Range matches a character in the range "0" to "9" (char code 48 to 57). Case sensitive.

Dash (DASH):

x

Character. Matches a "X" character (char code 88). Case sensitive.

[1-9A-HJ-NP-Za-km-z]

Character set. Match many character in the set. 1-9 Range matches a character in the range "1" to "9" (char code 49 to 57) Case sensitive. A-H Range matches a character in the range "A" to "H" (char code 65 to 72). J-N Range matches a character in the range "J" to "N" (char code 74 to 78). P-Z Range matches a character in the range "P" to "Z" (char code 80 to 90). Case sensitive. a-k Range matches a character in the range "a" to "k" (char code 97 to 107). Case sensitive. m-z Range matches a character in the range "m" to "z" (char code 109 to 122). Case sensitive.

Tron (TRX):

T

Character. Matches the character "T". Case sensitive.

[A-Za-z1-9]

Character set. Matches any uppercase letter, lowercase letter, or digit. Case sensitive.

Dogecoin (DOGE):

D{1}

Character. Matches a single character that must be "D". Case sensitive.

[5-9A-HJ-NP-U]{1}

Character set. Matches a single character that must be either a digit from 5 to 9 or a uppercase letter excluding I, O, and Q. Case sensitive.

[1-9A-HJ-NP-Za-km-z]{32}

Character set. Matches a sequence of 32 characters that must be either an uppercase letter excluding I, O, and Q, a digit, or a lowercase letter excluding 'l' and 'o'. Case sensitive.

Litecoin (LTC):

[LM3]{1}

Character. Matches a single character that must be either L, M, or 3.. Case sensitive.

[a-km-zA-HJ-NP-Z1-9]{26,33}

Character set. Matches a sequence of 26 to 33 characters that must be either a lowercase letter (excluding 'l'), an uppercase letter (excluding 'I' and 'O'), or a digit (excluding '0') but cannot contain 'o'. Case sensitive.

ltc1

Character. Matches the string "ltc1". Case sensitive.

[a-z0-9]{39,59}

Character set. Matches a sequence of 39 to 59 characters that must be either a lowercase letter or a digit. Case sensitive.

Solana (SOL):

[1-9A-HJ-NP-Za-km-z]

Character set. Match many character in the set. 1-9 Range matches a character in the range "1" to "9" (char code 49 to 57) Case sensitive. A-H Range matches a character in the range "A" to "H" (char code 65 to 72). J-N Range matches a character in the range "J" to "N" (char code 74 to 78). P-Z Range matches a character in the range "P" to "Z" (char code 80 to 90). Case sensitive. a-k Range matches a character in the range "a" to "k" (char code 97 to 107). Case sensitive. m-z Range matches a character in the range "m" to "z" (char code 109 to 122). Case sensitive.

Flags

g

Global search. Retain the index of the last match, allowing subsequent searches to start from the end of the previous match. Without the global flag, subsequent searches will return the same match.

Grouping and Capturing

(bc1|[13])

Bitcoin (BTC): Capturing Group. Groups multiple tokens together and creates a capture group for extracting a substring or using a backreference. b Character matches a "b" character (char code 98). Case sensitive. c Character matches a "c" character (char code 99). Case sensitive. 1 Character matches a "1" character (char code 49). | Alternation acts like a boolean OR. Matches the expression before or after the "|". Character set Matches any character in the set; 1 character matches a "1" character (char code 49), 3 character matches a "3" character (char code 51).

Last updated