How do I replace a string with another string in VEX (e.g. change ../shop/.. to ../shopnet1/.. in the material path)?
Since there is no replace I tried to use re_replace. Not working unfortunately. What do I miss here? What kind of syntax is needed?
Cheers!
Tom
String replacement in VEX
14649 7 1- Tom Mangold
- Member
- 96 posts
- Joined: Nov. 2017
- Offline
- tamte
- Member
- 8599 posts
- Joined: July 2007
- Offline
Tom Mangolddo you have specific not working example in mind?
Not working unfortunately.
as the straightforward case works:
string path = "../shop/principled1"; s@path = re_replace("../shop/", "../shopnet1/", path);
however if you want to be safe and really use correct regex you may need to do :
string path = "../shop/principled1"; s@path = re_replace(r"\.\./shop/", "../shopnet1/", path);
since otherwise . represents any character so it would match any 2 starting characters not just ..
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- HristoVelev
- Member
- 59 posts
- Joined: Nov. 2017
- Offline
- OdFotan
- Member
- 192 posts
- Joined: April 2015
- Offline
- tamte
- Member
- 8599 posts
- Joined: July 2007
- Offline
- OdFotan
- Member
- 192 posts
- Joined: April 2015
- Offline
Looked for wildcard syntax in regex, but I don't really understand it or find the right answer. Do you know it? It's practically the only thing I need to know.
With the Attr String Edit SOP I have this problem that it operates on the updates values also. (Already submitted an RFE for an option to have an option to iterate on input values only)
See picture: In the end just everything is 'capBottom', 'capTop' is just dissapeared
Thats why I went into a wrangle, because there I could write it unto a temporary attribute.
-
With the Attr String Edit SOP I have this problem that it operates on the updates values also. (Already submitted an RFE for an option to have an option to iterate on input values only)
See picture: In the end just everything is 'capBottom', 'capTop' is just dissapeared
Thats why I went into a wrangle, because there I could write it unto a temporary attribute.
-
Edited by OdFotan - June 4, 2021 11:22:27
- tamte
- Member
- 8599 posts
- Joined: July 2007
- Offline
- OdFotan
- Member
- 192 posts
- Joined: April 2015
- Offline
-
- Quick Links