import re#导入包 a="dword ptr [ecx + 0x528], 0x562b0248" b="ecx, dword ptr [eax + 4]" c="ecx, dword ptr [r*14 + 4]" d="4" print(re.findall(pattern=r'\b0x[0-9a-fA-F]+\b', string=a)) print(re.findall(pattern=r'\b[0-9a-fA-F]+\b', string=c)) print(re.search(pattern=r'\b[0-9a-fA-F]+\b', string=d).group())