fork download
  1. import re
  2. text = "hey a2a 3beauty hou\se heyYou2"
  3. print(re.sub(r"\s*(?<!\S)(?![a-zA-Z][a-zA-Z0-9]*(?!\S))\S+", "", text))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
hey a2a heyYou2