
![]() | re.findall finds all matches (re.search finds the first)
>>> r = r"\d+\.\d*" >>> s = "3.29 is a number, 4.2 and 0.5 too" >>> re.findall(r,s) ['3.29', '4.2', '0.5'] |
![]() | Application to the interval example:
(lower, upper) = re.findall(real, '[-3, 9.87E+02]') # real: regex for real number |