user2548: Can anyone help me in creating a regular expression to preg_match (php) all of Cardano's public wallet address formats?

user382: A regex itself isn't capable of validating if an address is valid or not. You need to have a little more logic. Probably what you're looking for is something like from_bytes/from_bech32/from_base58 utilized in this library: https://github.com/Emurgo/cardano-serialization-lib/blob/master/rust/src/address.rs
If you really need it to just be a regex, shelley addresses are pretty easy to validate in bech32 format, it's addr1[a-z0-9]+ and byron addresses are base58 encoded [1-9A-HJ-NP-Za-km-z]+. But neither of these ensure the address is accepted by the blockchain, it just loosely restricts the character set accepted.

2548: <p>Can anyone help me in creating a regular expression to preg_match (php) all of Cardano's public wallet address formats?</p>
 382: <p>A regex itself isn't capable of validating if an address is valid or not. You need to have a little more logic. Probably what you're looking for is something like from_bytes/from_bech32/from_base58 utilized in this library: <a href="https://github.com/Emurgo/cardano-serialization-lib/blob/master/rust/src/address.rs" rel="nofollow noreferrer">https://github.com/Emurgo/cardano-serialization-lib/blob/master/rust/src/address.rs</a></p>
<p>If you really need it to just be a regex, shelley addresses are pretty easy to validate in bech32 format, it's <code>addr1[a-z0-9]+</code> and byron addresses are base58 encoded <code>[1-9A-HJ-NP-Za-km-z]+</code>. But neither of these ensure the address is accepted by the blockchain, it just loosely restricts the character set accepted.</p>
