fork download
  1. import re
  2. text = "An example striiiiing with other words"
  3. rx = re.compile(r'i{3,}', re.I)
  4. out_put = rx.sub(lambda x: r'*'*len(x.group()), text)
  5. print(out_put)
  6. # An example str***iing with other words
Success #stdin #stdout 0.03s 9552KB
stdin
Standard input is empty
stdout
An example str*****ng with other words