kgoossens Posted February 21, 2012 Share Posted February 21, 2012 (edited) Hi, I try to test if a string in a path "$HIP/bladibla" is matching the same string. So I was trying the following strmatch(chs("path"),"$HIP/bladibla") strmatch(evals(chsraw("path")),"$HIP/bladibla") strmatch(chs("path"),chs("path")) strmatch(evals(chsraw("path")),evals(chsraw("path"))) None of the above seem to work. It always returns 0. Am I doing something wrong here? Edited February 21, 2012 by kgoossens Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted February 21, 2012 Share Posted February 21, 2012 Hi, I try to test if a string in a path "$HIP/bladibla" is matching the same string. So I was trying the following strmatch(chs("path"),"$HIP/bladibla") strmatch(evals(chsraw("path")),"$HIP/bladibla") strmatch(chs("path"),chs("path")) strmatch(evals(chsraw("path")),evals(chsraw("path"))) None of the above seem to work. It always returns 0. Am I doing something wrong here? 1. Wont work. chs expands automaticly. So 0 is correct 2. Wont work cause evals expands the path instead. So 0 is correct 3 and 4. Dont know how it feels about matching two strings that equals each other so unsure if it returns correct. Quote Link to comment Share on other sites More sharing options...
kgoossens Posted February 21, 2012 Author Share Posted February 21, 2012 (edited) 1. Wont work. chs expands automaticly. So 0 is correct 2. Wont work cause evals expands the path instead. So 0 is correct 3 and 4. Dont know how it feels about matching two strings that equals each other so unsure if it returns correct. The last 2 I did to check whether I would work at all with using an expression inside. Strings that completely match each other do work. strmatch("aaa","aaa") returns 1 So if one wants to check if the string represented in the path would work, you would expect that strmatch(chsraw("path"),"$HIP/bladibla") would work no? Edited February 21, 2012 by kgoossens Quote Link to comment Share on other sites More sharing options...
gaurav Posted February 21, 2012 Share Posted February 21, 2012 Not sure if i get it right. but 1 and 3 seems to return correct result for me. Quote Link to comment Share on other sites More sharing options...
kgoossens Posted February 21, 2012 Author Share Posted February 21, 2012 Not sure if i get it right. but 1 and 3 seems to return correct result for me. Strange... Doing exactly the same. Quote Link to comment Share on other sites More sharing options...
gaurav Posted February 21, 2012 Share Posted February 21, 2012 Strange, attaching hip, If that helps. strmatch.hipnc Quote Link to comment Share on other sites More sharing options...
kgoossens Posted February 21, 2012 Author Share Posted February 21, 2012 Strange, attaching hip, If that helps. Thanks, but strangely enough your scene seems to give a different result over here as well??? I had something similar when I was trying to create a pre-render script umkdir -p `chs("../path")` It didn't work either. Does somebody recognizes this problem? Just installed the latest production build 11.1.201 still having the same problem. Quote Link to comment Share on other sites More sharing options...
anim Posted February 21, 2012 Share Posted February 21, 2012 you may try to use strcmp() instead if you have problems but read the help first, because returned values means different things, e.g. 0 is when they match Quote Link to comment Share on other sites More sharing options...
gaurav Posted February 21, 2012 Share Posted February 21, 2012 Does somebody recognizes this problem? Just installed the latest production build 11.1.201 still having the same problem. Mine is 11.1.118 running on Ubuntu. Quote Link to comment Share on other sites More sharing options...
kgoossens Posted February 21, 2012 Author Share Posted February 21, 2012 you may try to use strcmp() instead if you have problems but read the help first, because returned values means different things, e.g. 0 is when they match Ah, thanks! This works. Cheers! Still strange however that strmatch seems to react differently on my machine then on other peoples machines. somebody else with this problem? if len(yes)>0: kim.iWillPost(bug) Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted February 21, 2012 Share Posted February 21, 2012 strmatch(chsraw("path"),"$HIP/bladibla") This should work if my brain works correctly. chsraw will return the raw path. As in if $HIP, $HOME or something else is used it will not be expanded as /home/user/babab but instead return $HOME/babab Quote Link to comment Share on other sites More sharing options...
edward Posted February 22, 2012 Share Posted February 22, 2012 Don't we need to escape the $HIP as well? ie. strmatch(chsraw("path"),"\$HIP/bladibla") My guess as to why chs() works in one case but in the other is because $HIP is expanding to a path with spaces. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.