fork download
  1. import re
  2. regex = r"(?<=\b)\d+(?=[\s.,])"
  3. test_str = "Hi I am sony. My age 23. This is my email id sony.1510@gmail.com . Hi I am Jessey. My age 20. This is my email id jessey.1996@gmail.com . Hi I am ronald.My age 17 My mail id is ronald.1999@gmail.com"
  4.  
  5. matches = re.finditer(regex, test_str, re.MULTILINE)
  6.  
  7. for match in matches:
  8. print(match.group(0))
  9.  
  10.  
  11.  
Success #stdin #stdout 0s 23352KB
stdin
Standard input is empty
stdout
23
20
17