import res = r'abc123d, hello 3.1415926, this is my book'pattern = r'-?\d*\.?\d+'L = re.findall(pattern, s)print(L)
Standard input is empty
['123', '3.1415926']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!