RegEx to match Bitcoin addresses?

前端 未结 8 2264
深忆病人
深忆病人 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:24

    [^OIl] matches any character that's not O, I or l. The problems in your regex are:

    • You don't have a $ at the end, so it'd match any string beginning with a BC address.
    • You didn't count the first character in your {27,34} - that should be {26,33}

    However, as mentioned in a comment, a regex is not a good way to validate a bitcoin address.

提交回复
热议问题