php教程

User Contributed Notes

dulao5 at gmail dot com 28-Apr-2007 11:11
mb_ereg_search & subpatterns
use loop:
<?php
    $str
= "中国abc + abc ?!?!字符# china string";

   
$reg = "\w+";

   
mb_regex_encoding("UTF-8");

   
mb_ereg_search_init($str, $reg);
   
$r = mb_ereg_search();

    if(!
$r)
    {
        echo
"null\n";
    }
    else
    {
       
$r = mb_ereg_search_getregs(); //get first result
       
do
        {
           
var_dump($r[0]);
           
$r = mb_ereg_search_regs();//get next result
       
}
        while(
$r);
    }
?>

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788