
![]() | Let us test the simple regex on a more complicated text:
>>> l = re.search(r'\[(.*),(.*)\]', \
' [-3.2E+01,0.11 ] and [-4,8]').groups()
>>> print l
('-3.2E+01,0.11 ] and [-4', '8')
Regular expressions can surprise you...!
|
![]() | Fix:
\[([^,]*),([^\]]*)\]Note: only the first group (here interval) is found by re.search (use re.findall to find all) |