I'm trying to parse the readelf
output:
import re
o = ' EXIDX 0x000590 0x002c0590 0x002c0590 0x00008 0x00008 R 0x4'
re.findall(r'^ \s+ (\w+) \s+ (?:(0x [\da-f]+ )\s+)+', o, re.VERBOSE) # (1)
# [('EXIDX', '0x00008')]
Why does only one hexadecimal number gets captured? I expected
re.findall(r'^ \s+ (\w+) \s+ (?:(0x [\da-f]+ )\s+)+', o, re.VERBOSE)
# [('EXIDX', '0x000590', '0x002c0590', '0x002c0590', '0x00008', '0x00008')]
When I'm trying this RE instead, it gives at least understandable result of matching only the first number:
re.findall(r'^ \s+ (\w+) \s+ (0x [\da-f]+ )\s+', oo, re.VERBOSE)
# [('EXIDX', '0x000590')]
I don't get why I get only the last (?) number with RE (1)