第2个回答 2009-04-08
<?php
$str = "地球ewrpqpo原子能qwerqqwedq";
$pattern = "/[\xa1-\xff]{6,28}/"; //匹配中文汉字的正则表达式,每个汉字相当于两个字符,所以字符长度要乘以2
preg_match_all($pattern, $str, $out);
for($n=0;$n<count($out);$n++)
for($n1=0;$n1<count($out[$n]);$n1++)
echo $n.",".$n1.":\t".$out[$n][$n1]."<br>";
?>
输出:
0,0: 原子能
第3个回答 2009-04-05
用 . 通配符呀
preg_match("/.{3,14}/",$content,$a);