Jump to content

strmatch not working with expressions?


kgoossens

Recommended Posts

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 by kgoossens
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by kgoossens
Link to comment
Share on other sites

Strange, attaching hip, If that helps.

Thanks, but strangely enough your scene seems to give a different result over here as well???

strmatch2.png

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. :angry:

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...