Regular Expressions for DER signature hex (also req, address, TxIDs)? I'm using Python (2.7) and its re module for recognition of various Bitcoin data, namely:  


  addresses, DER sigs, OP Return hexdata, TxIDs


I've been using re.compile: for example, for a valid Tx hash (TxID):

RE_TXHASH = re.compile('^[0-9a-fA-F]{64}$')
if bool(re.match(RE_TXHASH, 'f'*64)):    # 'f'*63 would fail
    print 'valid tx hash!'
else:
    raise Exception("invalid tx hash!")


I'm looking for regex patterns for the following (or input on my current best attempt):


DER signatures: General format "30[sig_size]02[r_size]02[s_size][sighash]"
Bitcoin addresses:  re.compile('^[123mn]{1}[a-km-zA-HJ-NP-Z0-9]{26,33}$')
OP Return hex strings: re.compile('^(6a){1}[a-fA-F0-9]{0,80}$')
TxIDs: re.compile('^[0-9a-fA-F]{64}$')


EDIT: to clarify, can someone help with a regex pattern for this? "30[sig_size]02[r_size]02[s_size][sighash]"
For DER sigs, it's possible for R or S to be very small.


DER sigs: re.compile('^30[0-9a-fA-F]{72,136}02[0-9a-fA-F]{0,64}02[0-9a-fA-F]{0,64}[0-9a-fA-F]{8}')


Bitcoin addresses cannot have a 0. Also the {1} is superfluous


Bitcoin addresses: re.compile('^[123mn][a-km-zA-HJ-NP-Z1-9]{26,33}$')


Again, {1} is superfluous for OP_RETURN. Also, the a might be capitalized.


OP Return hex strings: re.compile('^6[aA][a-fA-F0-9]{0,80}$')


TXIDs are fine