fork download
  1. import re
  2.  
  3. my_string = "The value of the float is 2.5. The int's value is 2.\n"
  4. m = re.search("^(.*?)\.\s", my_string)
  5. if m:
  6. print(m.group(1))
  7.  
Success #stdin #stdout 0s 23296KB
stdin
Standard input is empty
stdout
The value of the float is 2.5