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

Post Reply
User avatar
TheCaptain
Member
Posts: 62
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

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

Post 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?
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

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

Post 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.
User avatar
TheCaptain
Member
Posts: 62
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

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

Post 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'
User avatar
TheCaptain
Member
Posts: 62
Joined: Mon Jan 18, 2016 4:22 pm
Location: London

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

Post 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!)
Post Reply