below is string Register addr = [0x0128], data = [0x59]
i want to get 0x59 not 0x0128 by using Regex
this is my code
import re
data = "Register addr = [0x0128], data = [0x59]"
pattern = re.compile("d[.]]")
re.findall(pattern, data)
i don't have idea to get exact 0x59 could you help me?
0x59the only string you wanna extract? or it may change?0x59always followed by word 'data' & '=' and within square brackerts?finditer/findallwith a appropriate pattern and keep the last. Mayber'(0x[^\]]+)'