I have regex for path parsing. Below is the part of regex that repeats multiple times.
dir_pattern = /
\/?
(?<dir> #pattern to catch directory
[^[:cntrl:]\/\n\r]+ #directory name
)
(?=\/) #indistinguishable from file otherwise
/x
Input:
/really/long/absolute/path/to/file.extension
Desired output:
to/really/long/file.extension
I want to cut off some (not all directories) and reorder remaining ones. How could I achieve that?
Since I'm already using regexes for filtering files needed, I would like to keep using them.