I have a string s = '10000'
,
I need using only the Python re.findall to get how many 0\d0
in the string s
For example: for the string s = '10000'
it should return 2
explanation: the first occurrence is 10000 while the second occurrence is 10000
I just need how many occurrences and not interested in the occurrence patterns
I've tried the following regex statements:
re.findall(r'(0\d0)', s) #output: ['000']
re.findall(r'(0\d0)*', s) #output: ['', '', '000', '', '', '']
Finally, if I want to make this regex generic to fetch any number then any_number_included_my_number then the_same_number_again, how can I do it?