5

What is the best, most correct way of regex'ing the address and payment ID for Monero?

1
  • To avoid duplication can you edit this question to better emphasize how it is different? Perhaps focus on the payment ID part (or an integrated address) which was not discussed in the previous question.
    – Smart Kid
    Nov 3, 2016 at 0:50

1 Answer 1

9

A Monero address:

4[0-9AB][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{93}

A payment ID:

([0-9a-fA-F]{16}|[0-9a-fA-F]{64})
5
  • [0-9a-fA-F]{64}
    – user36303
    Nov 1, 2016 at 17:36
  • 1
    I believe | is useless in the first regexp
    – Kukunin
    Sep 2, 2017 at 8:25
  • 1
    The | was actually an error (worse than useless) because it would match a literal pipe character. Now fixed. Sep 20, 2017 at 12:01
  • Address could be reduced: ^4[0-9AB][1-9A-HJ-NP-Za-km-z]{93}$ Feb 24, 2018 at 19:14
  • Can you update to include subaddresses please?
    – sgp
    Nov 27, 2022 at 22:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.