Skip to content

Instantly share code, notes, and snippets.

@MasFlam
Last active March 25, 2024 02:22
Show Gist options
  • Save MasFlam/84477ca88842e245dc7a4cc61ce299e3 to your computer and use it in GitHub Desktop.
Save MasFlam/84477ca88842e245dc7a4cc61ce299e3 to your computer and use it in GitHub Desktop.
Regular expressions for matching monero addresses

Tip

See the XmrAddr libraries.

Monero Address Regex

This is a collection of best-you-can-do regular expressions matching Monero addresses of each kind and network type. Keep in mind to actually verify an address you should validate the checksum, so use these only for preliminary filtering of data, UI validation, etc. where false positives won't hurt. Also, I semi-purposefully didn't include regex for integrated addresses, which are nowadays considered deprecated by many, including myself.

Mainnet

Regular address: 4[1-9AB][1-9A-HJ-NP-Za-km-z]{93}

Subaddress: 8[2-9ABC][1-9A-HJ-NP-Za-km-z]{93}

Testnet

Regular address: [9A][12s-z][1-9A-HJ-NP-Za-km-z]{93}

Subaddress: B[YZa-h][1-9A-HJ-NP-Za-km-z]{93}

Stagenet

Regular address: 5[1-9AB][1-9A-HJ-NP-Za-km-z]{93}

Subaddress: 7[2-9AB][1-9A-HJ-NP-Za-km-z]{93}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment