If you don’t want to match the first character, then regular negative pre-checking can also be done. It's a pity that sed doesn't support it, that's how it is with Python
# encoding: UTF-8
import re
print re.sub(r'(?!^)\/','-', '/tmp/aa/bb.txt')
Output/tmp-aa-bb.txt
The more complex the statement, the lower the maintainability, so why bother.
Is this so?
If you don’t want to match the first character, then regular negative pre-checking can also be done. It's a pity that sed doesn't support it, that's how it is with Python
Output
/tmp-aa-bb.txt
The more complex the statement, the lower the maintainability, so why bother.