fork download
  1. import re
  2.  
  3. regex1 = r"^-(?=[a-zA-Z]+$)"
  4. regex2 = r"^([a-zA-Z0-9]+)-([a-zA-Z]+)$"
  5.  
  6. slist = ["-args", "-111111", "20-args", "20 - 20", "20-10", "args-deep"]
  7. slist = list(map(lambda s: re.sub(regex2, r"\1 \2", re.sub(regex1, "", s)), slist))
  8.  
  9. print(slist)
Success #stdin #stdout 0.02s 27728KB
stdin
Standard input is empty
stdout
['args', '-111111', '20 args', '20 - 20', '20-10', 'args deep']