Am I correct that "match patterns" cannot help here?

Hello all!
Just want to confirm the following – hoping to prevent me falling down a rabbit-hole unnecessarily, in trying to kludge something together that is not possible to kludge!
What I'm wanting to do:
Dump a PDF into a root-folder, have Hazel look at the UNIQUE number sequence in the filename – find an already existing sub-folder with that same UNIQUE number sequence in its sub-folder name, and drop that file into that sub-folder.
Details:
I work inside Devonthink, that indexes a root folder inside Finder containing hundreds of sub-folders, named [First-name Surname_Client-Number].
The files inside those sub-folders, are mostly PDFs downloaded from our CMS, or 'printed' from Outlook.
(I realise that I can send directly into DTPO - but for a variety of reasons, the files must first be placed into Finder, which DTPO then indexes).
So I do the following:
a.) New client – manually create a new sub-folder inside the Root Folder, using the [First-name Surname_Client-Number] naming regime.
a1.) If the sub-folder already exists, ignore the 1st step.
b.) Save PDFs off my CMS system/PDFs out of Outlook, of emails pertaining to that client, into that Client's sub-folder.
Each PDF has a particular type of naming regime (using TextExpander), but the unique identifier within that filename, is again the Client's [First-name Surname] and [Client-number].
So the filename of those PDFs could be "DD-MM-YYYY_Consultation1_Floaty McFloaty_123423432" OR "DD-MM-YYYY_Email received_Query on Sale_Floaty McFloaty_123423432" etc.
This works fairly well, since with Default Folder X, and Keyboard Maestro, quite a few steps are removed from the process.
But obviously, IF Hazel can auto-sort the PDFs, then a major friction point will be removed (mainly due to the number of steps involved between a.) and b.), involving selecting where to place the Files etc.).
Why I doubt Hazel can help:
If I understand "pattern matching" correctly, then Hazel looks for
Or is there something that can be done to tell Hazel to "watch all in this folder – if a Filename is dropped into it, where this part of the filename MATCHES this part of a sub-folder name inside the Root folder – then move that File into that Folder".
I would be gob-smacked if this was possible. Not at all a criticism of Hazel, which is obviously extremely powerful, but can only (understandably) work within certain predictable 'fields'. Regardless, figured I would just check!
Many thanks!
Just want to confirm the following – hoping to prevent me falling down a rabbit-hole unnecessarily, in trying to kludge something together that is not possible to kludge!

What I'm wanting to do:
Dump a PDF into a root-folder, have Hazel look at the UNIQUE number sequence in the filename – find an already existing sub-folder with that same UNIQUE number sequence in its sub-folder name, and drop that file into that sub-folder.
Details:
I work inside Devonthink, that indexes a root folder inside Finder containing hundreds of sub-folders, named [First-name Surname_Client-Number].
The files inside those sub-folders, are mostly PDFs downloaded from our CMS, or 'printed' from Outlook.
(I realise that I can send directly into DTPO - but for a variety of reasons, the files must first be placed into Finder, which DTPO then indexes).
So I do the following:
a.) New client – manually create a new sub-folder inside the Root Folder, using the [First-name Surname_Client-Number] naming regime.
a1.) If the sub-folder already exists, ignore the 1st step.
b.) Save PDFs off my CMS system/PDFs out of Outlook, of emails pertaining to that client, into that Client's sub-folder.
Each PDF has a particular type of naming regime (using TextExpander), but the unique identifier within that filename, is again the Client's [First-name Surname] and [Client-number].
So the filename of those PDFs could be "DD-MM-YYYY_Consultation1_Floaty McFloaty_123423432" OR "DD-MM-YYYY_Email received_Query on Sale_Floaty McFloaty_123423432" etc.
This works fairly well, since with Default Folder X, and Keyboard Maestro, quite a few steps are removed from the process.
But obviously, IF Hazel can auto-sort the PDFs, then a major friction point will be removed (mainly due to the number of steps involved between a.) and b.), involving selecting where to place the Files etc.).
Why I doubt Hazel can help:
If I understand "pattern matching" correctly, then Hazel looks for
- Code: Select all
(text) (text) (text) (text) (text)_(digit) (digit) (digit) (digit)
Or is there something that can be done to tell Hazel to "watch all in this folder – if a Filename is dropped into it, where this part of the filename MATCHES this part of a sub-folder name inside the Root folder – then move that File into that Folder".
I would be gob-smacked if this was possible. Not at all a criticism of Hazel, which is obviously extremely powerful, but can only (understandably) work within certain predictable 'fields'. Regardless, figured I would just check!
Many thanks!