fork download
  1. import re
  2. text = '123 !"§$%&/()= äüöüÄÖÜÄßßßß hello-123, hello-hello, hello-.'
  3. print( re.sub(r'-?\d+-?|[^\w -]|_|-(?!\w)|(?<!\w)-', '', text).strip() )
  4.  
Success #stdin #stdout 0.02s 9512KB
stdin
Standard input is empty
stdout
äüöüÄÖÜÄßßßß hello hello-hello hello