Page MenuHomePhabricator

Add ircount() function
Open, Needs TriagePublic

Description

In many cases, we need to use count() or rcount() with case-insensitivity.

Currently, it is doable, but the solution (which is documented) is to use rcount() with a pattern such as '(?i)pattern' or '(?i:pattern)'. I find myself using this a lot.

Thus, implementing a ircount() function would be trivial and would allow to write cleaner filters. It would also be a nice complement, as we already have the rlike / irlike siblings.


As a side note, I noticed it is significantly faster to use a case-insensitive regex search, than a plain string search combined with lowercasing the arguments. It is because lcase() is actually quite slow, as it uses mb_* functions (refs FilterEvaluator.php#L838-L846 and Language.php#L2697-L2716).

Event Timeline

I think this would be useful simply because I think people often don't realize/know about (?i) and so use lcase when using rcount.