case-insensitive

Can PHP's glob() be made to find files in a case insensitive manner?

☆樱花仙子☆ 提交于 2019-12-25 05:34:15
问题 I want all CSV files in a directory, so I use glob('my/dir/*.CSV') This however doesn't find files with a lowercase CSV extension. I could use glob('my/dir/*.{CSV,csv}', GLOB_BRACE); But is there a way to allow all mixed case versions? Or is this just a limitation of glob() ? 回答1: Glob patterns support character ranges: glob('my/dir/*.[cC][sS][vV]') 回答2: You could do this $files = glob('my/dir/*'); $csvFiles = preg_grep('/\.csv$/i', $files); 回答3: glob('my/dir/*.[cC][sS][vV]') should do it.

is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?

折月煮酒 提交于 2019-12-25 04:58:11
问题 Using PHP/Codeigniter/HTMLPurifier/CSStidy like so: require_once 'extra/htmlpurifier-4_4_0/library/HTMLPurifier.auto.php'; require_once 'extra/csstidy-1_3/class.csstidy.php'; $input_css = $this->input->post('input_css'); $config = HTMLPurifier_Config::createDefault(); $config->set('Filter.ExtractStyleBlocks', TRUE); // Create a new purifier instance $purifier = new HTMLPurifier($config); // Wrap our CSS in style tags and pass to purifier. // we're not actually interested in the html response

Python: How to sort a list of objects using attrgetter with case insensitivity

∥☆過路亽.° 提交于 2019-12-24 18:00:10
问题 self.data = sorted(self.data, key=attrgetter('word')) self.data is a list of Word objects. Word objects have 'word', 'definition', 'example' and 'difficulty' attributes. I want to sort by the 'word' strings of each Word object, and the code above does that except it's not case insensitive. How would I go about making the sorting case insensitive? I've tried the solutions from another question asked here, but when I tried it, it said "TypeError: 'Word' object is not subscriptable". What could

PHP case sensitive path's issue

巧了我就是萌 提交于 2019-12-24 16:53:27
问题 I am running a SocialEngine PHP application, which i've recently migrated to another server. And from that point on - a problem occurs: The SocialEngine's core trying to include files in case insensitive paths, which appear not to exist (although, in the right case, they do exist) How can I make the PHP/Apache act nicer, and also search in other cases? For example, the SocialEngine looks for /application/modules/Menuitems.php , and the right path is /application/modules/Menu**I**tems.php . To

how to ignore case-sensitiveness and include nested documents when searching on Rails 4 with Mongoid

别说谁变了你拦得住时间么 提交于 2019-12-24 13:25:36
问题 parent.rb class Parent include Mongoid::Document field :name, type: String field :hobby, type: String field :born, type: Date has_many :children accepts_nested_attributes_for :children def self.search(search) if search any_of({name: search}, {hobby: search}) end end end child.rb: class Child include Mongoid::Document field :name, type: String field :hobby, type: String field :born, type: Date belongs_to :parent end parents_controller.rb class ParentsController < ApplicationController before

Matching against a large number of strings containing spaces in pyparsing

两盒软妹~` 提交于 2019-12-24 06:44:11
问题 With pyparsing I need to write a matcher for expressions like a + names + c with a = pp.OneOrMore(pp.Word(pp.alphas)) c = pp.OneOrMore(pp.Word(pp.nums)) and names matching one of many entries in the string list names_list . The two complications are: The entries in names_list can contain spaces . The matching needs to be case-insensitive . names_list is rather large (~20000 entries) I tried names_kw_list = [pp.Keyword(name, caseless=True) for name in names_list ] names = pp.Or(names_kw_list)

FindFirstFileEx doesn't operate case sensitive

孤人 提交于 2019-12-24 03:06:08
问题 Since I'm using a macro which seems to work if the given path is case unequal to the local path on the drive I first need to validate wether the path is case-wise existing or not. Unfortunately (in my case) Directory.Exists() is not case sensitive. So I tried FindFirstFileEx with dwAdditionalAttributes set to 1 which stands for FIND_FIRST_EX_CASE_SENSITIVE. However it seems not work for me. My local path is C:\Dir1\Dir2\Dir3 . The path I compare is C:\dir1\Dir2\Dir3 . Unfortunately I always

Possible to create case insensitive string class?

你说的曾经没有我的故事 提交于 2019-12-24 00:29:37
问题 What would be required to create a case-insensitive string type that otherwise behaves exactly like a string? I've never heard of anyone making a case insensitive string type like this and it's obviously not part of the framework, but it seems like it could be very useful. The fact that SQL does case insensitive comparisons by default is a great case in point. So I'm thinking it's either not possible, or else there's a really good reason why no one does it that I'm not aware of. I know it

How to perform a case-insensitive file search in Erlang/Elixir

老子叫甜甜 提交于 2019-12-23 20:11:29
问题 Elixir provides Path.wildcard , which uses the Erlang :filelib.wildcard function internally. Matching is case-sensitive, for example, "a" does not match "A". (http://erlang.org/doc/man/filelib.html#wildcard-1) Please is there a case-insensitive alternative? 回答1: There's no built in option to do this, but since the wildcard syntax supports character alternations similar to regex, you can replace every letter with an alternation of its lower and upper case versions, e.g. f0o -> [fF]0[oO] , and

Case-insensitive primary key of type nvarchar where ß != ss

时间秒杀一切 提交于 2019-12-23 20:00:27
问题 This question "Need a case insensitive collation where ss != ß" solves it for varchar type column, but mine has to be nvarchar . As far as I can gather, SQL_Latin1_General_Cp437_BIN differentiates between ß and ss . But it is also case-sensitive. Mine is a primary key column which also needs to be case INsensitive: I need e.g. weiß / Weiß to be considered equal, and also weiss / Weiss , but NOT weiß / weiss nor Weiß / Weiss nor weiß / Weiss etc. I've searched a lot for this, and is it really