sql_regcase
(PHP 4, PHP 5)
sql_regcase — 产生用于不区分大小的匹配的正则表达式
说明
sql_regcase
( string
$string
) : string产生用于不区分大小的匹配的正则表达式
Warning
自 PHP 5.3.0 起,已经废弃此函数。强烈建议不要应用此函数 。
参数
-
string
-
输入的字符。
返回值
返回与 string
相匹配的正则表达式,不论大小写字母。返回的表达式是将
string
中的每个字母字符转换为方括号表达式,该方括号表达式包含了该字母的大小写形式。其它字符保留不变。
范例
Example #1 sql_regcase() 例子
<?php
echo sql_regcase("Foo - bar.");
?>
以上例程会输出:
[Ff][Oo][Oo] - [Bb][Aa][Rr].
可以用于在仅支持区分大小写正则表达式的产品中完成不区分大小写的模式匹配。

User Contributed Notes 2 notes
edge at gts dot smtn dot stavropol dot ru ¶
15 years ago
if you set right locale:
setlocale(LC_CTYPE,"ru_RU.KOI8-R");
print sql_regcase("Цffnung");
will output:
"[Цц][Ff][Ff][Nn][Uu][Nn][Gg]"
phpcomment at revmaps dot no-ip dot biz ¶
5 years ago
This function naivley replaces the letters in your expression.
if your expression uses [] already using this will probably break it