日期:2014-05-16 浏览次数:20551 次
$s = '<td align="Center" rowspan="2" width="7%">aaaa<br>bbbb<br>cccc<br>dddd<br></td >';
echo preg_replace('/<br>\w+/', '', $s, 2);
<td align="Center" rowspan="2" width="7%">aaaa<br>dddd<br></td >
echo preg_replace('/<br>[^<]+/', '', $s, 2);
echo preg_replace('/\(.+?\)/', '', $s);
echo preg_replace_callback('/<br>[^<]+/', 'foo', $s, 2);
function foo($m){
return strpos($m[0], '(') !== false ? preg_replace('/\(.+?\)/','',$m[0]) : '';
}