Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
dguevara
Newbie


Joined: 08 Oct 2008
Posts: 9

PostPosted: Sat Aug 29, 2009 7:16 pm   

regex case insensitive?
 
%ismember and %regex are case insensitive or am i doing something wrong?


$testing = %ismember(%1,$scanTargets);
#if ( $testing ) {
#if ( %match(%item($scanTargets,$testing),%1)) {

#say %item($scanTargets,$testing) %1

}
#if ( %regex(%item($scanTargets,$testing),%1)) {


}

}
Reply with quote
dguevara
Newbie


Joined: 08 Oct 2008
Posts: 9

PostPosted: Sat Aug 29, 2009 9:08 pm   
 
ill make the example clearer

#if ( %regex("A Thri-Kreen","A thri-kreen")) {


}
#if ( %match("A Thri-Kreen","A thri-kreen")) {


these 2 match positive
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Aug 30, 2009 12:09 am   
 
They are indeed case insensitive by default in CMUD however you can do something about the default behavior.

#REG

Something probably should be said in the manual that because the %regex function and the #REG command are so similar that the info is good for both.
[edit]I went ahead and made a mention of this myself.[/edit]

Code:
#print {%regex("A Thri-Kreen","(?-i)A Thri-Kreen")}
#print {%regex("A ThRi-Kreen","(?-i)A Thri-Kreen")}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram

Last edited by Arminas on Sun Aug 30, 2009 12:57 am; edited 1 time in total
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Aug 30, 2009 12:29 am   
 
I'm sorry I neglected to show an example for setting match to case sensitive.

This uses in-line regex.

Code:
#print {%match("A Thri-Kreen","%/(?-i)/%A Thri-Kreen")}
#print {%match("A ThRi-Kreen","%/(?-i)/%A Thri-Kreen")}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net