我想从正则表达式中取出所有字符。
$str = "html code <script> var='a,b,c,d,e,f,g,h' </sript> html code";
preg_match_all ('#var =.((\w),?)+.#',$str,$m);
echo "<pre>";
print_r ($ m);
echo "</ pre>";
结果:
Array
(
[0] => Array
(
[0] => var = 'a, b, c, d, e, f, g, h'
)
[1] => Array
(
[0] => h
)
[2] => Array
(
[0] => h
)
)
h - 最后一个搜索符号,为什么?