fork download
  1. import re
  2.  
  3. def replace(e):
  4. return e
  5.  
  6. s = 'hi how are you today 23:i ok im good 1:e'
  7. rx = r'(?<!\S)(?!\d{1,2}:[ie](?!\S))\S+'
  8. print(re.sub(rx, lambda x: replace(x.group().lower()), s))
Success #stdin #stdout 0.02s 27752KB
stdin
Standard input is empty
stdout
hi how are you today 23:i ok im good 1:e