fork download
  1. import re
  2. string = "11 12 13 14"
  3.  
  4. def repl(m):
  5. number = int(m.group(1)) + 1
  6. return str(number)
  7.  
  8. print re.sub(r'\b(\d+)\b', repl, string)
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
12 13 14 15