I'm having trouble figuring out why the following regex doesn't seem to work.
I know that I can form other regular expressions to make this work, but I thought this one should work.
re.search ("(\d*)", "prefix 1234 suffix").groups()
('',)
Interestingly, findall seems to work:
re.findall("(\d*)", "prefix 1234 suffix")
['', '', '', '', '', '', '', '1234', '', '', '', '', '', '', '', '']
I understand why that works, but I'm still confused as to why search doesn't work? My understanding is that match should force it to match the whole string, but search should find the digits anywhere within the string