String matching

   8980   6   2
User Avatar
Member
949 posts
Joined: April 2008
Offline
I am trying to use the “match” vex function like this:

i@mymatch = match("obj_",@myattr);

Instead of matching attributes with 10,12,13 values it matches with 1,0,2,3.

What would be the correct way to match decimals?

Thanks!
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
279 posts
Joined: Dec. 2009
Offline
See here
http://www.sidefx.com/docs/houdini13.0/vex/functions/match [sidefx.com]

*z - Match any string beginning with a, b or c and ending with z.

So, try to match 1, 0, 1(but already tested), 2, 1(tested), and 3.


I think you may try with this expression

i@mymatch = match("obj_",@myattr);
User Avatar
Member
8592 posts
Joined: July 2007
Offline
you'll need to do
obj_1

for your case, but as houdini's patterns are slightly more limited than regular expressions it may easily happen that you can't create simple pattern covering all the matches you want

so you can just use these rules
http://www.sidefx.com/docs/houdini13.0/expressions/_patterns [sidefx.com]
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
949 posts
Joined: April 2008
Offline
Thanks for the feedback guys!

I'll try that.
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
949 posts
Joined: April 2008
Offline
Hi guys!

Here I am again with another question regarding matching strings in vex.

What would be in VEX the equivalent to the strreplace() expression?

I want to to change a attribute like:

$HIP/texture/mytexture.jpg to $HIP/texture/mytexture.rat

I would like to to that in a wrangle node is it possible?

Thanks!
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
8592 posts
Joined: July 2007
Offline
I think that's quite limited with current VEX functions, you could split() the string based on “.” to array, then replace last element with “rat” and than assemble back to string, but that feels like too much work for something that could be done easier

if however replacement of string attribute is what you are after, then have a look at AttributeStringEdit SOP, where you can even use regular expressions for substitutions
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
949 posts
Joined: April 2008
Offline
Cool! i'll try that for sure.

Thanks Thomas! Can I call you Thomas?

Thanks for the help, again!
https://vimeo.com/user2163076 [vimeo.com]
  • Quick Links