Rumah >pembangunan bahagian belakang >tutorial php >请教一个正则匹配问题
有一段内容
$neirong='aaaaaaaaaaaaaa<a href="1.html" target="_blank">啦啦啦啦</a>ddddddddddddddd';
echo preg_replace('#<a.+?</a>#s', '', $neirong);
<?php $string = 'aaaaaaaaaaaaaa<a href="1.html" target="_blank">啦啦啦啦</a>ddddddddddddddd'; echo preg_replace('/<a href="(?:.*)" target="_blank">(.*)<\/a>/Ui', '\1', $string); ?>
可以了,非常感谢两位