fork(1) download
  1. import re
  2. s = "shivam gupta"
  3. m = re.match(r"shivam\s+(\w+)$", s)
  4. if m: # if the pattern matches
  5. print(m.group(1)) # print only Group 1 contents
Success #stdin #stdout 0s 9016KB
stdin
Standard input is empty
stdout
gupta