Author

Topic: Regular expression for private key base 58? (Read 3872 times)

legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
Is that regex working? I'd put some parentheses

/^5[1-9A-Za-z][^OIl]{20,50}/
or
/^5([1-9A-Za-z][^OIl]){20,50}/

Try with some private keys from https://www.bitaddress.org/
member
Activity: 62
Merit: 45
I'm writing a bitcoin app and would like to validate addresses somehow.  I found this regex for public addresses:

/^[13n][1-9A-Za-z][^OIl]{20,40}/

But I'm looking for one for base 58 private keys as well.  (Base 58 is the import format right?)

I don't know a lot about the rules for these keys/addresses.  If I did I'd just write the regexes myself.  Any help is much appreciated.
Jump to: