I want to match dynamically created URLs which can have multiple folders. Need some regex pattern for this. For ex.
http://127.0.0.1:8000/api/:user_id/:foldersa/:folders1/
http://127.0.0.1:8000/api/:user_id/:foldersb/:folders2/:folders3/:folders4
http://127.0.0.1:8000/api/:user_id/:foldersc/:folders2/
http://127.0.0.1:8000/api/:user_id/:foldersd/:folders1/:folders2/
so till BASE_URL/api/:user_id/ is common. I can catch user_id but want to catch other params after user_id on a single string variable.
after that, there can be any number of folders and I want to catch them all in one single string variable.
like for first URL string variable caught will be "foldera/folder1/" and for next url string variable will be "folderb/folder2/folder3/folder4" along with fwd slashes.
What regex pattern should I write in urls.py for capturing this folders?
I tried with
re_path(r'(?P<user_id>[-\w]+)/(?P<customUrl>(.*?)(?:\/)?$)/.*', customLink, name='customLink'),
but couldn't get it to work.