Page 1 of 1

[Solved] Parsing data from filename separated by a character

Posted: Fri Mar 20, 2015 5:45 pm
by gabrielp
Is there an easy way to pull values from the jobNameProper with separators in this format?
Image

Essentially I need a way to capture the first, second, third, and fourth value separated by an underscore.

Re: Parsing data from filename separated by a character

Posted: Mon Mar 23, 2015 11:50 am
by bens
You'll probably need a regular expression; I don't think the string manipulation for variables is strong enough.

Do you have the scripting module? If so, you can use this:

Code: Select all

var theRegex = /(.*)_(.*)_(.*)_(.*)_.*/;
theRegex.search( job.getNameProper() );
var theCompleteMatch = theRegex.cap(0);
var thePlateID = theRegex.cap(1);
//...

Re: Parsing data from filename separated by a character

Posted: Mon Mar 23, 2015 5:41 pm
by gabrielp
Thanks man. Exactly what I was looking for. I have an e-book on regex I have had for a while now. Maybe it's time to finally read it. 8-)