Page 1 of 1

How to Search for "Filename*<insert any text>.extension"

Posted: Mon Oct 17, 2016 3:41 pm
by TheCaptain
I am using this Text Variable as part of a Hierarchy path :

Code: Select all

[Job.Origin:Search="(\d{5})"]
The input into Switch is :

FILE - 38921_RANDOM TEXT.indd

... from within the FOLDER - 38921_Client_Brand_Item

Using my Text Variable I reduce the Job Path to '38921', but then wish to drop the FILE back into ANY Folder starting with 38921. However, my Text Variable is looking for a precise path (in the case, a Folder simply named '38921')

How would I go about adding a wildcard to the path i.e Any FOLDER starting with '38921' but the following characters could be anything

Any thoughts?

Re: How to Search for "Filename*<insert any text>.extension"

Posted: Mon Oct 17, 2016 3:57 pm
by freddyp
You will need a script (expression) to check if there is a folder present starting with that string and to put the name of that folder in the job's hierarchy.

Note that yYou have to consider that there could be multiple folders starting with that name. If that is not possible or if you can always take the first one (or last one) a script expression will do. Otherwise you will need a script that has outgoing traffic-light connections so you can detect that multiple folders were found. Also when the job has to go into all folders starting with that name you will need a script.

Re: How to Search for "Filename*<insert any text>.extension"

Posted: Mon Oct 17, 2016 4:05 pm
by TheCaptain
I get you. With regard to Multiple outputs, or options, I can achieve this with multiple paths in a WorkFlow I think. Also, I don't believe our Server would allow more than one instance of a foldername so that probably won't occur. I'll throw in some safeguards anyhow.

Are you able to offer any guidance on the expression?

I start with the Path String : '38521'

... but need the file to travel into something like : '38521_EnfocusFolder'

Re: How to Search for "Filename*<insert any text>.extension"

Posted: Mon Oct 17, 2016 5:43 pm
by TheCaptain
ETA.

The best I can come up with is :

Code: Select all

[Job.Origin:Search=".+?(?=\/).+?(?=\/).+?(?=\/).+?(?=\/).+?(?=\/)"]
This seems to work in other formats (returning the whole Path String up to the nth forward slash.) But critically, NOT in Switch :(

(I'm presuming this could be cutdown somewhat. I've butchered it I think!)