时间:2021-07-01 10:21:17 帮助过:24人阅读
$a="https://www.baidu.com
aaaaaa
https://www.163.com
";
$ret= preg_replace(
'/((news
------解决思路----------------------
telnet
------解决思路----------------------
nttp
------解决思路----------------------
file
------解决思路----------------------
http
------解决思路----------------------
ftp
------解决思路----------------------
https):\/\/)(([-A-Za-z0-9]+(\.[-A-Za-z0-9]+)*(\.[-A-Za-z]{2,5}))
------解决思路----------------------
([0-9]{1,3}(\.[0-9]{1,3}){3}))(:[0-9]*)?(\/[-A-Za-z0-9_\$\.\+\!\*\(\),;:@&=\?\/~\#\%]*)*/',
'\0',$a);
echo $ret;
?>
$a='https://www.baidu.com
aaaaaa
https://www.163.com
';
$new=preg_replace('/((https
------解决思路----------------------
http):\/\/[^<]+)/i',"$1",$a);
echo $new;
/*
https://www.baidu.com
aaaaaa
https://www.163.com
*/