Thanks for reaching out to Microsoft Q&A.
A prefix match string of container1/sub1/ applies to all blobs in the container named container1 that begin with the string sub1/.
Since, you have directories with different names part of the same container. It seems that the feasible approach would be to create separate lifecycle management policies for each folder/directory. https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-faq#the-blob-prefix-match-string-didn-t-apply-the-policy-to-the-expected-blobs
As an alternative, you will need to develop a custom script and incorporate the function app sample method outlined in the article below.
Lifecycle Management, Page Blob, Azure Storage, Blob Storage (microsoft.com)
Please let us know if you have any further queries. I’m happy to assist you further.