I have a string, Can be any of the below cases:
- test1/test2/test3/test4/test5/
- test1/test2/test3/test4//
- test1/test2/test3///
- test1/test2////
- test1/////
My expected results are
- test1/test2/test3/test4/test5
test1/test2/test3/test4
test1/test2/test3
- test1/test2
- test1 How can i achieve using regex ?
Currently, i am using regexp_replace(col, "/+/", "/") it is working but leaving an extra / on the end.
/, filter out empty strings from the array, join with/.