'option' parameter has the same syntax as 'option' parameter from 'mb_regex_set_options' function.
mb_ereg_match
(PHP 4 >= 4.2.0, PHP 5)
mb_ereg_match — マルチバイト文字列が正規表現に一致するか調べる
説明
bool mb_ereg_match
( string
$pattern
, string $string
[, string $option = "msr"
] )マルチバイト文字列に対する正規表現マッチングを行います。
パラメータ
-
pattern -
正規表現パターン。
-
string -
評価する文字列。
-
option -
返り値
string が正規表現
pattern に一致する場合にTRUE 、
そうでない場合に FALSE を返します。
注意
注意:
内部エンコーディングあるいは mb_regex_encoding() で指定した文字エンコーディングを、 この関数の文字エンコーディングとして使用します。
patryk dot szczyglowski at gmail dot com
12-Dec-2008 09:54
Anonymous
18-Oct-2008 06:52
Note that this function matches a string from the beginning only (though not necessarily till the end):
<?php
$test = mb_ereg_match("a", "some apples"); // returns false
$test = mb_ereg_match("a", "a kiwi"); // returns true
?>
If you want to check for a match anywhere in the string, use the wild-card & repeat operators .*
<?php
$test = mb_ereg_match(".*a", "some apples"); // returns true
?>
