我想替换一个html中的所有超链接中的换行,该怎么写,比如
<a href="asd" title="sdfsdf
sdf">123123</a>
把它替换成成
<a href="asd" title="sdfsdfsdf">123123</a>
<a href="asd" title="sdfsdf
sdf">123123</a>
把它替换成成
<a href="asd" title="sdfsdfsdf">123123</a>
$str = '<a href="asd" title="sdfsdf
sdf">123123</a>';
$pattern = '/title=\"(\S+)(\s+)(\S+)\"/';
echo preg_replace($pattern, 'title="$1$3"', $str);