case-insensitive

Rails validates_uniqueness_of across multiple columns with case insensitivity

谁都会走 提交于 2019-12-21 03:33:11
问题 I have a model that has two fields, which I will call first_name and last_name, and I want to make sure that the combination of the two are case-insensitively unique. I've gotten halfway there by using this: validates_uniqueness_of :first_name, :scope => :last_name The problem is that the uniqueness check seems to be case sensitive, even though the documentation says it should be case insensitive by default. So given an existing record: { :first_name => 'John', :last_name => 'Smith' } This

How to do case-insensitive order in Rails with postgresql

梦想与她 提交于 2019-12-20 10:26:44
问题 I am in the process of switching my development environment from sqlite3 to postgresql 8.4 and have one last hurdle. In my original I had the following line in a helper method; result = Users.find(:all, :order => "name collate NOCASE") which provided a very nice case-insensitive search. I can't replicate this for postgresql. Should be easy - any ideas? Thanks. 回答1: result = Users.find(:all, :order => "LOWER(name)") To take a little bit from both Brad and Frank. 回答2: LanecH's answer adapted

Contains method case-insensitive without major code changes?

こ雲淡風輕ζ 提交于 2019-12-20 06:35:35
问题 Is there a way to ignore the case for the contains() method but at the same time leave the code snippet more or less the same? /** * This method returns a list of all words from the dictionary that include the given substring. * */ public ArrayList<String> wordsContaining(String text) { int index = 0; ArrayList<String> wordsContaining = new ArrayList<String>(); while(index<words.size()) { if((words.get(index).contains(text))) { wordsContaining.add(words.get(index)); } index++; } return

JS - jQuery inarray ignoreCase() and contains()

余生颓废 提交于 2019-12-19 17:03:54
问题 well, I am more of a PHP person, and my JS skills are close to none when it comes to any JS other than simple design related operations , so excuse me if I am asking the obvious . the following operations would be a breeze in PHP (and might also be in JS - but I am fighting with unfamiliar syntax here ...) It is some sort of input validation var ar = ["BRS201103-0783-CT-S", "MAGIC WORD", "magic", "Words", "Magic-Word"]; jQuery(document).ready(function() { jQuery("form#searchreport").submit

Rails Routes - How to make them case insensitive?

怎甘沉沦 提交于 2019-12-19 16:51:22
问题 Routes in Ruby on Rails are case sensitive. It seems someone brought this up before, and it has been labeled will not fix. http://rails.lighthouseapp.com/projects/8994/tickets/393-routes-are-case-sensitive That strikes me as unfortunate, as I don't really see any upside on my own application for routes to be case sensitive, while on the downside it creates a potential for confusion and a general appearance of lack of polish in my opinion. What's the best way to make my routes case insensitive

Laravel case insensitive routes

谁说胖子不能爱 提交于 2019-12-19 07:16:12
问题 How do I define a case insensitive (part of a) route? Example: Route::get('/{userId}/profile'); http://domain.com/123/profile works fine. Any use of uppercase in the fixed part of the route does not work: http://domain.com/123/Profile does not work http://domain.com/123/proFILE does not work I understand how I can make parameters like {parameter} use a regex pattern using ->with(), but that does not help me with the fixed part of the route, like described above. 回答1: This can be solved by

Ignore case when trying to match file names using find command in Linux

孤者浪人 提交于 2019-12-19 05:22:17
问题 Right now, all I know to use is: find / -name string.* that is case sensitive and it won't find files named: 1string.x STRing.x string1.x How can I search so that all the above would be returned in the search to a case-insensitive matching? 回答1: Or you could use find / | grep -i string 回答2: Use the -iname option instead of -name . 回答3: This works as well, if you want to avoid the single quotes: find . -iname \*string\* 回答4: Use -iname in find for case insensitive file name matches. 回答5: If

How can I do case insensitive git diffing while also doing `git diff --color`?

孤者浪人 提交于 2019-12-19 05:19:38
问题 Is it possible to do a case insensitive git diff while also doing git diff --color-words ? Or do I need to use an external diff program while doing git diff --color-words ? ( note: if all you want is git diff case insensitive please go to this question How to perform case insensitive diff in Git ) 回答1: GIT_EXTERNAL_DIFF='diff -ipu "$2" "$5" #' git diff --ext-diff Or, in a nicer fashion without the # hack I used there: echo 'diff -ipu "$2" "$5"' >myscript; chmod a+x myscript; GIT_EXTERNAL_DIFF

Case insensitive search in jqGrid including hidden fields

試著忘記壹切 提交于 2019-12-19 04:18:31
问题 I have few hidden fields in my jqGrid on which I have to perform a case insensitive search (may be using regex - not sure). Is it possible? Can someone give me directions on it? Thanks! 回答1: You should inseart searchhidden option equal to true in the column definition ( colModel ): searchoptions:{searchhidden:true} To make searching case insensitive you can use jQgrid option ignoreCase:true. 来源: https://stackoverflow.com/questions/3977657/case-insensitive-search-in-jqgrid-including-hidden

How can Python regex ignore case inside a part of a pattern but not the entire expression? [duplicate]

故事扮演 提交于 2019-12-19 02:04:19
问题 This question already has answers here : restrict 1 word as case sensitive and other as case insensitive in python regex | (pipe) (2 answers) Closed last month . Say I have a string containing foobar fooBAR FOObar FOOBAR , and I want to search all instances containing a case insensitive "foo" or "FOO" but a lowercase "bar". In this case, re.findall should return ['foobar', 'FOObar'] . The accepted answer for this question explains that it can be done in C# with (?i)foo(?-i)bar , but Python