I got a string containing the "txid" which should be checked.
All the best;
the txid is the sha-1 hash of a transaction. you can't use the txid to determine whether a transaction is valid, because any 64 digit hexadecimal number can be a txid.
It's not the SHA-1 it is the SHA256d. Also quite confusingly, the output bytes are reversed when displayed to the user!
The RegEx you are looking for is:
/^[0-9a-f]{64}$/i