PHP Doku:: Regular expression match for multibyte string - function.mb-ereg-match.html

Verlauf / Chronik / History: (50) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzUnterstützung menschlicher Sprache und ZeichenkodierungMultibyte StringMultibyte String Funktionenmb_ereg_match

Ein Service von Reinhard Neidl - Webprogrammierung.

Multibyte String Funktionen

<<mb_encoding_aliases

mb_ereg_replace>>

mb_ereg_match

(PHP 4 >= 4.2.0, PHP 5)

mb_ereg_matchRegular expression match for multibyte string

Beschreibung

bool mb_ereg_match ( string $pattern , string $string [, string $option = "msr" ] )

A regular expression match for a multibyte string

Parameter-Liste

pattern

The regular expression pattern.

string

The string being evaluated.

option

Rückgabewerte

Returns TRUE if string matches the regular expression pattern, FALSE if not.

Anmerkungen

Hinweis:

Das interne Encoding oder das mit mb_regex_encoding() festgelegte Zeichenencoding wird als Zeichenencoding für diese Funktion genutzt.

Siehe auch


2 BenutzerBeiträge:
- Beiträge aktualisieren...
patryk dot szczyglowski at gmail dot com
12.12.2008 18:54
'option' parameter has the same syntax as 'option' parameter from 'mb_regex_set_options' function.
Anonymous
18.10.2008 15: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

?>



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)