I have strings like
abcdef
abcd|(
abcde|(foo
abcd|)
abcde|)foo
which should be modified to
abcdef
abcd
abcde \foo
abcd
abcde \foo
- if there is no
|then do nothing - if nothing follows the
|(or|)then delete these two characters - if something follows then replace
|(or|)with<space>\
I am interested in short pattern expressions, if possible. I can do this by several string.find and string.sub but then I have a lot of if statements.
if nothing follows?|(or|)are the last characters. If there is no|, thenbar)should be unchanged