正则后面写isU是什么意思?什么是贪婪模式什么是非贪婪模式?
看看这段代码
<?php
$content = '<a href="http://www.dayanmei.com" target="_blank">aaa</a>';
preg_match_all("/href=\"(.*)\"/isU",$content,$out1);
print_r($out1[1]);
preg_match_all("/href=\"(.*)\"/i",$content,$out2);
print_r($out2[1]);
?>
输出的结果是这样的
<?php
Array ( [0] => http://www.dayanmei.com )
Array ( [0] => http://www.dayanmei.com" target="_blank )
?>
可见第一个匹配的尽量的少的内容,这就是非贪婪模式U
i表示不区分大小写