Observe that the type of the output is:
Pay-to-Public-Key (P2PK) outputs do not have addresses. They pay directly to a public key rather than the hash of the public key, as the name suggests. Bitcoin addresses encode public key hashes, for example, addresses starting with a 1 are known as Pay-to-Public-Key-Hash (P2PKH) ...
The hash160 of the script is
Prepend the version byte 05
Double sha-256 gives a checksum of
first 4 bytes: 7f297f31
Addresses that start with 2 on testnet or more precisely scripts that are like OP_HASH160 <hash> OP_EQUAL are P2SH scripts and the hash is created by computing HASH160 of a redeem script. Your redeem script seems to be a P2WPKH one which makes your address a P2SH-P2WPKH address. Your redeem script that has to be hashed is OP_0 <160-bit hash of ...
The following regex should work for validating that a string starts with one of xpub, ypub, Ypub, zpub, Zpub, tpub, upub, Upub, vpub or Vpub and is followed by 79-108 characters that are one of 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz (the Base58 alphabet) which is as close as you can get to validating BIP32 keys with regex:
P2PK scripts have the form PUSH <KEY> OP_CHECKSIG.
Means push 0x41 (65) bytes. This is followed by the public key (starting with 04 incidicating it is an uncompressed public key). Finally, 0xac is ...