Is it possible to use a delimiter to retreive parts of a variable without scripting?

Post Reply
Evan
Member
Posts: 30
Joined: Mon Feb 28, 2011 6:44 pm

Is it possible to use a delimiter to retreive parts of a variable without scripting?

Post by Evan »

Hello all,



When defining condition with variable, is there a way to use a delimiter and retreive part of a string using index without scripting?



Any other way are welcome!



Example in "88888_-_1_-_A_-_asdf.pdf"



if delimiter = "_-_"



Then



Index1 = "88888"

Index2 = "1"

Index3 = "A"

Index4 = "asdf.pdf"



So I can use my filename to direct my flow.



Thanks!
Peter Kleinheider
Newbie
Posts: 17
Joined: Mon Dec 13, 2010 4:52 pm

Is it possible to use a delimiter to retreive parts of a variable without scripting?

Post by Peter Kleinheider »

Evan,



I'm afraid that this is not possible, yet.



I am with you that this would be a great feature enhancement when working with variables.



Peter
Evan
Member
Posts: 30
Joined: Mon Feb 28, 2011 6:44 pm

Is it possible to use a delimiter to retreive parts of a variable without scripting?

Post by Evan »

For those with my problem, I turn to use a script expression. Here a example of code I use to name a job.



In "88888_-_1_-_A_-_16.pdf" the result will be "88888_Signature1_16pages.pdf"





var filename = job.getNameProper()

var filenameArray = filename.split("_-_")

var completeString = (filenameArray[0] + "_Signature" + filenameArray[1] + "_" + filenameArray[3] + "pages")

completeString

freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Is it possible to use a delimiter to retreive parts of a variable without scripting?

Post by freddyp »

Although I fully agree with the fact that a separator-based string extract is a great enhancement, there is something you can do with the string of the file name in your example.



The 88888 is easily extracted with [[Job.NameProper:Before=_]. The same goes for the 16:[Job.NameProper:After=_]. The 1 of the signature number can be extracted with [Job.NameProper:Search="_[0-9]{1,2}_"] (the {1,2} allows for one digit or two digits as we can safely assume you can have more than 9 signatures. The only thing that is not yet perfect is that the result will be _1_. When you drop the first underscore the regular expression starts matching the 88888.



Again, it is not perfect, but at least it is helpful for those who do not have the scripting module.
Post Reply