I have a folder tree like /country/province/city/home
that I want to get all sub-paths in it:
/country
/country/province
/country/province/city
/country/province/city/home
I can use pattern (?<=/)[\w]*
to get all the words and then join them one by one with '/'.join()
. But is there any way to achieve all the sub-paths with one regex ?