The following code extracts floating numbers from given text/string using Python regex.
Example
import re s = "Sound Level: -11.7 db or 15.2 or 8 db" result = re.findall(r"[-+]?\d*\.\d+|\d+", s) print result
Output
This gives the output
['-11.7', '15.2', '8']