Questions tagged [case-insensitive]

An operation is case insensitive when uppercase and lowercase characters are equally treated.

1146 questions
3384
votes
31 answers

Case insensitive 'Contains(string)'

Is there a way to make the following return true? string title = "ASTRINGTOTEST"; title.Contains("string"); There doesn't seem to be an overload that allows me to set the case sensitivity. Currently I UPPERCASE them both, but that's just silly (by…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
2007
votes
16 answers

How to do case insensitive search in Vim

I'd like to search for an upper case word, for example COPYRIGHT in a file. I tried performing a search like: /copyright/i # Doesn't work but it doesn't work. I know that in Perl, if I give the i flag into a regex it will turn the regex into a…
Haiyuan Zhang
  • 40,802
  • 41
  • 107
  • 134
769
votes
15 answers

How do I do a case-insensitive string comparison?

How can I compare strings in a case insensitive way in Python? I would like to encapsulate comparison of a regular strings to a repository string, using simple and Pythonic code. I also would like to have ability to look up values in a dict hashed…
Kozyarchuk
  • 21,049
  • 14
  • 40
  • 46
563
votes
15 answers

How to make "case-insensitive" query in Postgresql?

Is there any way to write case-insensitive queries in PostgreSQL, E.g. I want that following 3 queries return same result. SELECT id FROM groups where name='administrator' SELECT id FROM groups where name='ADMINISTRATOR' SELECT id FROM groups…
Jame
  • 21,150
  • 37
  • 80
  • 107
534
votes
10 answers

Case insensitive regular expression without re.compile?

In Python, I can compile a regular expression to be case-insensitive using re.compile: >>> s = 'TeSt' >>> casesensitive = re.compile('test') >>> ignorecase = re.compile('test', re.IGNORECASE) >>> >>> print casesensitive.match(s) None >>> print…
Mat
  • 82,161
  • 34
  • 89
  • 109
498
votes
14 answers

Contains case insensitive

I have the following: if (referrer.indexOf("Ral") == -1) { ... } What I like to do is to make Ral case insensitive, so that it can be RAl, rAl, etc. and still match. Is there a way to say that Ral has to be case-insensitive?
Nate Pet
  • 44,246
  • 124
  • 269
  • 414
420
votes
16 answers

How can I search (case-insensitive) in a column using LIKE wildcard?

I looked around some and didn't find what I was after so here goes. SELECT * FROM trees WHERE trees.`title` LIKE '%elm%' This works fine, but not if the tree is named Elm or ELM etc... How do I make SQL case insensitive for this wild-card…
David Morrow
  • 8,965
  • 4
  • 29
  • 24
394
votes
27 answers

MongoDB: Is it possible to make a case-insensitive query?

Example: > db.stuff.save({"foo":"bar"}); > db.stuff.find({"foo":"bar"}).count(); 1 > db.stuff.find({"foo":"BAR"}).count(); 0
Luke Dennis
  • 14,212
  • 17
  • 56
  • 69
361
votes
8 answers

How to set Sqlite3 to be case insensitive when string comparing?

I want to select records from sqlite3 database by string matching. But if I use '=' in the where clause, I found that sqlite3 is case sensitive. Can anyone tell me how to use string comparing case-insensitive?
quantity
  • 4,051
  • 3
  • 23
  • 20
351
votes
5 answers

How do you do a case insensitive search using a pattern modifier using less?

It seems like the only way to do this is to pass the -i parameter in when you initially run less. Does anyone know of some secret hack to make something like this work /something to search for/i
mk.
  • 26,076
  • 13
  • 38
  • 41
323
votes
15 answers

How to perform case-insensitive sorting array of string in JavaScript?

I have an array of strings I need to sort in JavaScript, but in a case-insensitive way. How to perform this?
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
300
votes
1 answer

How to query Case-insensitive data in Django ORM?

How can I query/filter in Django and ignore the cases of my query-string? I've got something like and like to ignore the case of my_parameter: MyClass.objects.filter(name=my_parameter)
Ron
  • 22,128
  • 31
  • 108
  • 206
291
votes
12 answers

Case-insensitive search

I'm trying to get a case-insensitive search with two strings in JavaScript working. Normally it would be like this: var string="Stackoverflow is the BEST"; var result= string.search(/best/i); alert(result); The /i flag would be for…
Chris Boesing
  • 5,239
  • 3
  • 26
  • 30
264
votes
7 answers

Case insensitive searching in Oracle

The default behaviour of LIKE and the other comparison operators, = etc is case-sensitive. Is it possible make them case-insensitive?
sergionni
  • 13,290
  • 42
  • 132
  • 189
264
votes
9 answers

How can I do a case insensitive string comparison?

How can I make the line below case insensitive? drUser["Enrolled"] = (enrolledUsers.FindIndex(x => x.Username == (string)drUser["Username"]) != -1); I was given some advice earlier today that suggested I use:…
Jamie
  • 2,657
  • 2
  • 16
  • 3
1
2 3
76 77