fork download
  1. import re
  2. text = "the asbestos fiber <unk> <unk| is < unusually <unk once it enters the <<unk>$% with "
  3. replacement = " "
  4. pattern: str = r'(?:(?!<unk>)[\W_](?<!<unk>))+'
  5. print( re.sub(pattern, replacement, text, flags=re.I) )
  6.  
Success #stdin #stdout 0.02s 9616KB
stdin
Standard input is empty
stdout
the asbestos fiber <unk> unk is unusually unk once it enters the <unk> with