mb_ereg_search_pos

(PHP 4 >= 4.2.0, PHP 5)

mb_ereg_search_posReturns position and length of a matched part of the multibyte regular expression for a predefined multibyte string

說明

array mb_ereg_search_pos ([ string $pattern [, string $option = "ms" ]] )

Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string

The string for match is specified by mb_ereg_search_init(). If it is not specified, the previous one will be used.

參數

pattern

The search pattern.

option

The search option.

回傳值

An array containing two elements. The first element is the offset, in bytes, where the match begins relative to the start of the search string, and the second element is the length in bytes of the match.

If an error occurs, FALSE is returned.

註釋

Note:

mb_regex_encoding() 指定的內部編碼或字元編碼將會當做此函式用的字元編碼。

參見

add a note add a note

User Contributed Notes 1 note

up
0
v dot picture at free dot fr
3 years ago
This function is absolutely not multibyte-safe, it actually returns the position of the match as if the string was not multibyte.

The results of this function are exactly the same as if you were using preg_match_all with PREG_OFFSET_CAPTURE, even with the "unicode" flag it's simply NOT working

(Bug report filed)
To Top