Questions tagged [case-insensitive]

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

1041 questions
3106
votes
28 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
  • 82,870
  • 79
  • 201
  • 297
1777
votes
15 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
  • 36,164
  • 38
  • 101
  • 131
637
votes
11 answers

How do I do a case-insensitive string comparison?

How can I do case insensitive string comparison in Python? I would like to encapsulate comparison of a regular strings to a repository string using in a very simple and Pythonic way. I also would like to have ability to look up values in a dict…
Kozyarchuk
  • 18,211
  • 13
  • 38
  • 46
452
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
  • 38,422
  • 114
  • 251
  • 393
410
votes
9 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
  • 67,636
  • 33
  • 83
  • 106
338
votes
24 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
  • 13,172
  • 17
  • 52
  • 66
333
votes
11 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
  • 3,771
  • 3
  • 21
  • 20
328
votes
15 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
  • 7,448
  • 4
  • 27
  • 24
317
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.
  • 24,966
  • 13
  • 35
  • 40
283
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,159
  • 3
  • 24
  • 30
257
votes
15 answers

How to perform case-insensitive sorting 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
  • 51,859
  • 84
  • 263
  • 429
239
votes
6 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
  • 12,462
  • 41
  • 121
  • 182
229
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,307
  • 2
  • 13
  • 3
219
votes
19 answers

Case-insensitive search in Rails model

My product model contains some items Product.first => # I'm now importing some product parameters from another dataset, but there are inconsistencies in the spelling of the names. For instance, in the other…
Jesper Rønn-Jensen
  • 91,561
  • 40
  • 112
  • 147
202
votes
10 answers

Case insensitive replace

What's the easiest way to do a case-insensitive string replacement in Python?
Adam Ernst
  • 45,666
  • 17
  • 55
  • 71
1
2 3
69 70