Subscribe Bookmark RSS Feed

Case Insensitive searches

Hegedus

Community Trekker

Joined:

Jun 23, 2011

Hi,

Most JMP is case insensitive except when it comes to text values.

Since text data is often messy and case is one way it shows up, is there a way to do case insensitive  versions of Contains?

3 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013


regex is case sensitive by default,  PatMatch is insensitive by default.


regex("The Quick Brown Fox", "quick", "\0", IGNORECASE);

"Quick"

regex("The Quick Brown Fox", "quick", "\0");

returns missing

rc = PatMatch("The Quick Brown Fox", patPos()>>where + "quick">>what);

show(rc,where,what);

rc = 1;

where = 4;

what = "Quick";

PatMatch("The Quick Brown Fox", patPos()>>where + "quick">>what, NULL, MATCHCASE);

returns 0

Regex

Craige
melaniedrake

Staff

Joined:

May 30, 2014

If you want to specifically use Contains(), you can use Lowercase() or Uppercase() to perform case-insensitive searches:

str1 = "Hello";

str2 = "ELL";

Contains( Lowercase(str1), Lowercase(str2) );

Contains( Lowercase(str1), "ell" );

Contains( Lowercase(str1), Lowercase("Ell") );

Craige_Hales

Staff

Joined:

Mar 21, 2013

more information on case and regex: Back Reference

Craige