Regular expressions allow you to search by range. Thus, to find a byte whose first chunk is "4", use:
pattern = re.compile(b"[\x40-\x4F]")
The following test shows that it produces the desired output:
>>> for byte in ('\x3f', '\x40', '\x42', '\x4f', '\x50'): print bool(pattern.search(byte)) ... False True True True False
To answer your specific question about finding 0xDEAD4xxx, use:
my_pattern = re.compile(b"\xDE\xAD[\x40-\x4F].")
source share