I am writing a script for dealing with bitcoin hashing and it would be useful to have a function to validate Testnet WIF , both uncompressed (starting with 9) and compressed (starting with c), such as:
92Pg46rUhgTT7romnV7iGW6W1gbGdeezqdbJCzShkCsYNzyyNcc
cNJFgo1driFnPcBdBX8BrJrpxchBWXwXCvNH5SoSkdcF6JXXwHMm
#https://en.bitcoin.it/wiki/List_of_address_prefixes
I have got regexes for most of other types of addresses, including regexes for mainet WIF types but they don't seem to match if I merely add [9c] to the prefix list.. I read somewhere that prefix and ending of testnet WIFs are different from those of mainet. Below is the regex for mainet WIFs I have got and which does not work.
[59KLc][1-9A-HJ-NP-Za-km-z]{50,51}
UPDATE: THIS ACTUALLY WORKS THOIf you guys know a regex that could work with testnet WIFs, please let me know. Or point to a page of testnet WIFs I can check and try something myself (could not find anything that helped me on Google yet)..
Cheers
UPDATE:
OK, I reckon that regex is working when adding the right prefixes in the character list.
[...]