fork download
  1. import re
  2. s = "abc def déf äëü المزيد 한글 - 1 2 3 4 5"
  3. print( re.sub(r"\b[a-zA-Z]*[^\W\d_a-zA-Z][^\W\d_]*\b", "<FOREIGN>", s) )
Success #stdin #stdout 0.02s 9364KB
stdin
Standard input is empty
stdout
abc def <FOREIGN> <FOREIGN> <FOREIGN> <FOREIGN>  - 1 2 3 4 5