View Full Version : problem with substitute...

02 February 2008, 08:16 PM
Hey guys/girls.
I'm having a bit of trouble working with substitute:
Say I have an imagePlane "imageName.0001.jpg"
I want to strip it down to "imageName"
Eventually I will add "imageName.####.jpg" and "imageName.####iff" for a shake script...

Anyway, what I have is this:

string $imageSeq = "imageName.0001.jpg"; //(this is just an example of course
string $stripped = `substitute ".[0-9].jpg" ($imageSeq) ("");
print ($stripped);

It returns "imageName.00"

How do I get it to return just "imageName"?
I hope someone can help to explain this to me, I find it quite confusing.

02 February 2008, 08:22 PM
Try adding a * after the ]
And I think you missed a ` when copy/pasting your example.

string $imageSeq = "imageName.0001.jpg"; //(this is just an example of course
string $stripped = `substitute ".[0-9]*.jpg" ($imageSeq) ("")`;
print ($stripped);

02 February 2008, 09:49 AM

So that is just acting as a wildcard etc..
It's all a little vague I believe :) I'm sure I'll get the hang of it soon!

Thanks again!

P.s. Burnlington is a lovely place! I've spent a lot of summers there in my childhood with relatives...
Can't wait to go back for a visit ;)

02 February 2008, 02:02 PM
Yeah, when you do: [0-9] you are saying a single digit between 0 and 9. Adding the * after it means multiple digits between 0 and 9.

And yes, Burlington is a great place to raise a family :) Just far enough away from Toronto but an easy commute for me.

CGTalk Moderation
02 February 2008, 02:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.