Case insensitive regexp problem (for cyrillic languages only)
This is an open discussion with 4 replies, filed under General.
Search
Firstly, the syntax above is incorrect for using params, try
regexp: ({$url-term}|.*)/i
Although I can't promise this will work, but that would be how to use the param syntax in a regex.
That being said, that would match $url-term
or anything or nothing
, which is a very odd regex to use.
This works for me...
regexp:{$url-term}
Probably need to describe what I want to do. Maybe this can be solved in some other way.
I do golossary on terms. To simplify the search for the term I want to make ajax-filter for parts of words. To do this, as I understand, I can use regexp or like. However, Symphony does not support 'like'.
I rummaged in the documentation MySQL:
MySQL REGEXP is not case sensitive, except when used with binary strings
It seems that my problem stems from the fact that I use cyrillic characters. In Latin all right.
I found the solution. Not sure of this approach, but it works. The essence of the solution is to bring the query and retrieve data to a single case (lower).
file: field.input.php, line 220:
$where .= " AND ( lower(t{$field_id}_{$this->_key}.value) {$regex} lower('{$pattern}') OR lower(t{$field_id}_{$this->_key}.handle) {$regex} lower('{$pattern}') ) ";
Any comments are welcome.
Create an account or sign in to comment.
Can someone explain how to use case insensitive regexp in datasources filter? Something like this: regexp: {$url-term:.*}/i doesn't work. Thanks!