 |
dguevara Newbie
Joined: 08 Oct 2008 Posts: 9
|
Posted: 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)) {
}
} |
|
|
 |
dguevara Newbie
Joined: 08 Oct 2008 Posts: 9
|
Posted: 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 |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: 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 |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: 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 |
|
|
 |
|
|