case-insensitive

What is the most efficient case-insensitive grep usage?

痴心易碎 提交于 2019-12-03 10:22:27
My objective is to match email addresses that belong to the Yahoo! family of domains. In *nix systems (I will be using Ubuntu), what are the benefits and drawbacks to any one of these methods for matching the pattern? And if there is another, more elegant solution that I haven't been capable of imagining, please share. Here they are: Use grep with option -i : grep -Ei "@(yahoo|(y|rocket)mail|geocities)\.com" Translate characters to all upper case or lower case then grep : tr [:upper:] [:lower:] < /path/to/file.txt | grep -E "@(yahoo|(y|rocket)mail|geocities)\.com" Include a character set for

Case insensitive Rspec match

♀尐吖头ヾ 提交于 2019-12-03 09:41:56
I'm writing a Capybara test and using Rspec for the assertions. My test is failing because there is a CSS style being applied that is causing the text to be in all caps. How can I rewrite this so that it is a case insensitive assertion? "ALL CAPS".should include('All Caps') Here's improving on phoet's solution: page.body.should match(%r{#{string}}i) Unfortunately the syntax highlighting here isn't doing it much justice (it looks perfectly fine in Sublime Text) I only run into this issue when: Using poltergeist driver. (I don't know if this also happens with other drivers) Inspecting page , not

SQL SELECT LIKE (Insensitive casing)

我怕爱的太早我们不能终老 提交于 2019-12-03 08:06:31
问题 I am trying to execute the sql query: select * from table where column like '%value%'; But the data is saved as 'Value' ( V is capital ). When I execute this query i don't get any rows. How do i make the call such that, it looks for 'value' irrespective of the casing of the characters ? 回答1: use LOWER Function in both (column and search word(s)). Doing it so, you assure that the even if in the query is something like %VaLuE%, it wont matter select qt.* from query_table qt where LOWER(column

Find possible duplicates in two columns ignoring case and special characters

安稳与你 提交于 2019-12-03 07:19:00
Query SELECT COUNT(*), name, number FROM tbl GROUP BY name, number HAVING COUNT(*) > 1 It sometimes fails to find duplicates between lower case and upper case. E.g.: sunny and Sunny don't show up as a duplicates. So how to find all possible duplicates in PostgreSQL for two columns. Erwin Brandstetter lower() / upper() Use one of these to fold characters to either lower or upper case. Special characters are not affected: SELECT count(*), lower(name), number FROM tbl GROUP BY lower(name), number HAVING count(*) > 1; unaccent() If you actually want to ignore diacritic signs, like your comments

Why underline is usually used in the sql table names rather than camel case [closed]

Deadly 提交于 2019-12-03 03:34:21
In all the applications/examples I have already seen(eg. wordpress). The column table names use underline rather than camel case. I'd like to know if there are some technical incompatibility problems or it's a convention? Is it dependent of the system platform(Linux/Windows) or the sql dialect(Mysql, postgreSQL, DB2, Oracle, ...). For example in the following table I have used camel case and I haven't already had any problems/warnings about it! If I should/must refactor my table, why should/must I do it? Is SQL case insensitive about the table/column names? What about the dialects? CREATE

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

萝らか妹 提交于 2019-12-03 01:36:15
问题 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 回答1: You can also type command -I while less is running. It toggles case sensitivity for searches. 回答2: You can also set the environment variable LESS I use LESS=-Ri , so that I can pump colorized output from grep into it, and maintain the ANSI colour sequences. Another little used feature of less

SQL SELECT LIKE (Insensitive casing)

风流意气都作罢 提交于 2019-12-02 21:39:20
I am trying to execute the sql query: select * from table where column like '%value%'; But the data is saved as 'Value' ( V is capital ). When I execute this query i don't get any rows. How do i make the call such that, it looks for 'value' irrespective of the casing of the characters ? use LOWER Function in both (column and search word(s)). Doing it so, you assure that the even if in the query is something like %VaLuE%, it wont matter select qt.* from query_table qt where LOWER(column_name) LIKE LOWER('%vAlUe%'); If you want this column be case insensitive : ALTER TABLE `schema`.`table`

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

最后都变了- 提交于 2019-12-02 13:53:57
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 Juha Syrjälä You can also type command -I while less is running. It toggles case sensitivity for searches. You can also set the environment variable LESS I use LESS=-Ri , so that I can pump colorized output from grep into it, and maintain the ANSI colour sequences. Another little used feature of less that I found is starting it with +F as an argument (or hitting SHIFT + F while in less). This causes it

Case sensitive file extension and existence checking

吃可爱长大的小学妹 提交于 2019-12-02 10:14:28
问题 I need to check whether or not a file exists. Which can be accomplished by File#exists() method. But this existence checking is case sensitive. I mean if I have a file name some_image_file.jpg in code but if physically the file is some_image_file.JPG then this method says that the file doesn't exists. How can I check the file existence with case insensitivity to the extension and get the actual file name? In my scenario, I have a excel file. Each row contains metadata for files and the

Case sensitive file extension and existence checking

五迷三道 提交于 2019-12-02 04:39:18
I need to check whether or not a file exists. Which can be accomplished by File#exists() method. But this existence checking is case sensitive. I mean if I have a file name some_image_file.jpg in code but if physically the file is some_image_file.JPG then this method says that the file doesn't exists. How can I check the file existence with case insensitivity to the extension and get the actual file name? In my scenario, I have a excel file. Each row contains metadata for files and the filename. In some cases I have only the filename or other cases I can have full path. I am denoting a row as