RegEx to match Bitcoin addresses?

前端 未结 8 2202
深忆病人
深忆病人 2020-12-14 06:44

I am trying to come up with a regular expression to match Bitcoin addresses according to these specs:

A Bitcoin address, or simply address, is an iden

相关标签:
8条回答
  • 2020-12-14 07:27

    I am not into complicated solutions and this regex served the purpose for the most simplest validation, when you just don't want to receive complete nonsense.

    \w{25,}
    
    0 讨论(0)
  • 2020-12-14 07:30
    ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$
    

    bitcoin address is

    • an identifier of 26-35 alphanumeric characters
    • beginning with the number 1 or 3
    • random digits
    • uppercase
    • lowercase letters
    • with the exception that the uppercase letter O, uppercase letter I, lowercase letter l, and the number 0 are never used to prevent visual ambiguity.
    0 讨论(0)
提交回复
热议问题