fork download
  1. import re
  2.  
  3. regex = r"\w+[\w.]+(@gmail.com){1}"
  4.  
  5. test_str = "hello.89@gmail.com"
  6.  
  7. matches = re.finditer(regex, test_str)
  8.  
  9. for matchNum, match in enumerate(matches):
  10. matchNum = matchNum + 1
  11.  
  12. print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
  13.  
Success #stdin #stdout 0s 23304KB
stdin
Standard input is empty
stdout
Match 1 was found at 0-18: hello.89@gmail.com