I have a list of URIs and one parameter $path.
I want to match URIs based on that $path. I want to get all files in $path + all index files from subdirectories but ONLY for the first child. So I don’t wanna get all index files from all subdirectories.
Example: $path = /root
/root/index.shtml - MATCH ME (because file is in $path)
/root/root_one.shtml - MATCH ME (because file is in $path)
/root/one/index.shtml - MATCH ME (because im an index-child)
/root/two/index.shtml - MATCH ME (because im an index-child)
/root/two/test.shtml - DONT MATCH ME
/root/two/three/index.shtml - DONT MATCH ME
/root/2024/index.shtml - MATCH ME (because im an index-child)
/root/2024/one.shtml - DONT MATCH ME
At least based on my knowledge, I think I have to use two regex to match everything.
Match all files within directory: /news/[^/]+.shtml
Match all index.shtml on first childs: I have no idea.
So if someone could help me out. If you can do both in one regex, feel free to share.
Best regards.