Wildcard searching in IF-ELSE statements?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2009
Wildcard searching in IF-ELSE statements?

Hello!

I´m having a little problem here

Take a look at this


 string $test = "test_knee_test";
 
 if($test == "*_knee_*")
 	print "Yes";
 
 else print "No";
 


I want it to return Yes, but it doesn´t. Shouldn´t it?

If i do a search in maya like this:
select -r ("*_knee_*");

That selects what I want ...

... so why is not the if-statement working?

// Otto
 
  04 April 2009
because == is for exact comparison, i.e _knee_ == _knee_

if you want to use *, then use gmatch command.

if(`gmatch $test "*_knee_*"`)
 
  04 April 2009
Thank you Jefri, great!

Otto
 
  04 April 2009
Or use the "match" command as it will allow you to use more in depth regular expressions for hunting string matches
 
  04 April 2009
Okey, will try that too, thanks Free4
 
  04 April 2009
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:17 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.