View Full Version : Help with regular expression needed! +
10-18-2005, 02:55 PM
I have a string array containing names of attributes connected to a multiMessageAttribute. I want to get the names of the nodes that the attributes belong to (full path). Is there a way to do that?
As an alternative i've tried to extract the name by using a regular experssion, eg. by extracting the name "rShoulder" from "rShoulder.message", using this command:
match "[A-Z a-z _]*" "rShoulder.message".
This only gives me the shortName, wicth is not optimal. Also I am not shure if Maya node names can contain other characters than the ones stated in the expressions.
Also i initialy wanted to make a regularexpression, that returned everything before the character ".", but did not know how.
Ok, a mess and many questions! Hope you guys can give me some pointers!
10-18-2005, 04:22 PM
Try this link out, and see if it has what you need. I haven't looked, but this is my first stop for regular expression help.
10-18-2005, 04:40 PM
Thanks - That usefull stuff indeed!
Anybody know how to get the long path transform name based on a connection, as talked about above?`
10-18-2005, 06:41 PM
Ok, my bad!
This gives you eg: pCube1
listConnections -destination false -source true niels_characterNode.baseSkeleton;
But i had used the -plugs flag: pCube1.message
listConnections -plugs true -destination false -source true niels_characterNode.baseSkeleton;
Thanks anyway! :-)
10-18-2005, 06:50 PM
Instead of using a regular expression, I would tokenize out the name like so:
int $numT = `tokenize "rShoulder.message" "." $hold`;
Now just use ls to get the full path
ls -l $hold;
Does that do what you want?
10-18-2005, 10:15 PM
Yeah, that looks cool!
Tokonize was the first thought I had as well. But then again, i don't really need the bit after the ".", and i'm using it in a loop, soo I found a nice regular exp. on the page you posted, that good for code economy: Eg. match "^[^\.]*" "janus.message".
But what I needed was the full path and listConnections (That I have to use anyway) actually returns it, with the right flags. Soo I'm good for now, but nice to be prepared for next time.
Thanks a million man!
10-18-2005, 10:15 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.