Zcash regexes

Is there a collection of regexes for viewing keys, sapling address, taddress, UAs, etc … ?

3 Likes

Hey, good q. I’m a humble man so I just rock stuff like:

Sapling zaddr: /^zs[a-z0-9]{76}$/
VK: /^zxviews[a-z0-9]{278}$/
UA looks like it’s something like: /^u1[a-z0-9]{176}$/

Yeah they’re simplistic and only partially validate the key. I think there are some invalid characters we could omit from matching, but these have been good enough for my purposes so far.

I guess the short answer is, (I think) no. There’s not an organized collection! :slight_smile: Hopefully this discussion gives us one!

4 Likes

This isn’t quite regexes, but we have been working on a new zcash_address Rust crate specifically for parsing Zcash addresses (and now also Unified Full/Incoming Viewing Keys). The first version of this crate will be published in the next week or so, ahead of zcashd 5.0.0. In the meantime, you can view its current API (and WIP documentation) here:

5 Likes