$string='
<a href="http://www.DOMAINa.com" target="_blank">1</a>
<a title="b" href="http://DOMAINa.com" target="_blank">2</a>
<a title="c" href="http://DOMAINa.com/test#a">3</a>
<a href="http://www.DOMAINb.com" target="_blank">4</a>
';
$pattern = '/<a[^>]+>(.*)<\\/a>/i';
$output = preg_replace($pattern, '', $str);
// should echo
// 1
// 2
// 3
// <a href="http://www.DOMAINb.com" target="_blank">4</a>
Need to remove all links from DOMAINa.com
- It may appear as http://www.DOMAINa.com, http://DOMAINa.com or http://www.DOMAINa.com/...something
Could you please help with the expression?