Applescript lookup table

Hi, I'm new to Hazel and am looking for some sorting advice.
I have filenames of which part should be used to move it to a folder.
Problem is the filename and the foldername are only partially similar.
Example. File "Sprint p00458 layout.txt" needs to be moved into a subfolder of "557482 Sprint".
From what I've been told this requires either separate rules for each instance (insane amount of work, to many folders, to often new ones). Or applescript.
Now, I know very little about applescript. What I think I need is a basic lookup table. Should be bale to do that with property lists. Put the token from Hazel into applescript to get the folder name back and put that back into hazel as the folder name.
Anyone that can help me with this?
Thanks.
I have filenames of which part should be used to move it to a folder.
Problem is the filename and the foldername are only partially similar.
Example. File "Sprint p00458 layout.txt" needs to be moved into a subfolder of "557482 Sprint".
From what I've been told this requires either separate rules for each instance (insane amount of work, to many folders, to often new ones). Or applescript.
Now, I know very little about applescript. What I think I need is a basic lookup table. Should be bale to do that with property lists. Put the token from Hazel into applescript to get the folder name back and put that back into hazel as the folder name.
Anyone that can help me with this?
Thanks.