im trying to check for the a tags which contains specific domain ... but this a tag might be with or without www , hhtp , https
$a = ' <a href="https://example.com"></a>
<a href="http://www.example.com"></a>
<a href="http://example.com"></a>
<a href="https://www.example.com"></a>
<a href="http://example.com"></a>
';
$reg_exUrl = "/(http|https)\:\/\/(www.)?example+\.com(\/\S*)?/";
preg_match($reg_exUrl, $a, $url) ;
var_dump($url);
but i dont get all the links this is the output
array:2 [▼
0 => "https://example.com"
1 => "https"
]
also im not sure how to include href so it would only search inside href