Home  >  Article  >  php教程  >  PHP中多字节字符的preg_match_all

PHP中多字节字符的preg_match_all

WBOY
WBOYOriginal
2016-06-08 17:23:541179browse

本文章给大家介绍PHP中多字节字符的preg_match_all实例,大家可参考。

 代码如下 复制代码

function mb_ereg_match_all($pattern, $subject, array &$subpatterns)
{
if(!mb_ereg_search_init($subject, $pattern)) // 初期化?I理
return false;
$subpatterns = array();
while($r = mb_ereg_search_regs()) { // 初期化?I理で?定したパタ?ンと文字列から?仕?br /> $subpatterns[] = $r;
}
return true;
}

$pattern = ‘[^s ]+’;
$subject = ‘你好, 吃了么。 我吃 的包子加油条。’;
mb_ereg_match_all($pattern, $subject, $result);
print_r($result);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn