Req #66637 [Wfx]: Please don't remove sql_regcase
Edit report at https://bugs.php.net/bug.php?id=66637&edit=1
ID: 66637
User updated by: marco at thenetworksolution dot it
Reported by: marco at thenetworksolution dot it
Summary: Please don't remove sql_regcase
Status: Wont fix
Type: Feature/Change Request
Package: *Regular Expressions
PHP Version: 5.4.24
Block user comment: N
Private report: N
New Comment:
Hi. There is just one use case in which nor PCRE nor charset and collation are useful. This case is
solvable with sql_regcase.
Please consider this use case:
"perform a case insensitive and accent insensitive word search (must match only entire
words)"
- utf8_general_ci allows you to make an equality (WHERE field = value) case and accent insensitive
search but it doesn't allow you to specify an entire word match (word boundaries markers not
recognized)
- LIKE allows you case and accent insensitive search but you have to manually specify all
combinations of possible word boundaries charactes (word boundaries markers not recognized)
- word boundaries [[:<:]] and [[:>:]] are supported in REGEXP, who is a single byte functions
so don't perform accent insensitive search.
The solution is to use REGEXP with word boundaries and the word modified in the way sql_regcase
does.
Used on http://www.genovaperte.it
Previous Comments:
------------------------------------------------------------------------
[2014-02-03 20:17:48] requinix@php.net
It has been deprecated because there are better alternatives:
* In PHP: using the PCRE functions and the /i flag for case-insensitivity.
* In SQL: depends on the DBMS but many problems can be solved by using the right charset and
collation. In MySQL you'd use, for example, utf8_general_ci on the column. [1]
[1] http://dev.mysql.com/doc/refman/5.6/en/charset-general.html
------------------------------------------------------------------------
[2014-02-03 20:05:51] marco at thenetworksolution dot it
Description:
------------
Just noticed that I've just reimplemented in my project the sql_regcase.
Please don't remove, it is useful in implementing accent insensitive searches on top of MySQL.
---
From manual page: http://www.php.net/function.sql-regcase
---
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66637&edit=1
Thread (4 messages)