What is the best way to replace each occurrence of a leading or trailing hyphen with a space?
For example, I want
---ab---c-def--
to become
000ab---c-def00 (where the zeros are spaces)
I'm trying to do this in Python, but I can't seem to come up with a regex that will do the substitution. I'm wondering if there is another, better way to do this?