sql_regcase

(PHP 3, PHP 4, PHP 5)

sql_regcase --  产生用于不区分大小的匹配的正则表达式

说明

string sql_regcase ( string string )

返回与 string 相匹配的正则表达式,不论大小写字母。返回的表达式是将 string 中的每个字母字符转换为方括号表达式,该方括号表达式包含了该字母的大小写形式。其它字符保留不变。

例子 1. sql_regcase() 例子

<?php
echo sql_regcase ("Foo - bar.");
?>

输出为:

[Ff][Oo][Oo] - [Bb][Aa][Rr].

可以用于在仅支持区分大小写正则表达式的产品中完成不区分大小写的模式匹配。


add a note add a note User Contributed Notes
edge at gts dot smtn dot stavropol dot ru
25-Jun-2003 09:56
work, if you set right locale:

setlocale(LC_CTYPE,"ru_RU.KOI8-R");

print sql_regcase("&#1062;ffnung");

will output:
"[&#1062;&#1094;][Ff][Ff][Nn][Uu][Nn][Gg]"
m-blueml__NO at SPAM__imagetype dot de
01-Oct-2002 07:29
Will not work with special Characters like , and .

print sql_regcase("ffnung");
will output:
"[Ff][Ff][Nn][Uu][Nn][Gg]"

Markus