This will work if I don't misunderstood your question.
$html = '<a href="https://www.website.com/n/?confirm.php" ></a>';
preg_match_all('/href="([^\s"]+)/', $html, $match);
print '<pre>';
print_r($match);
print '</pre>';
print $match[1][0];
Edited: As per comment, you didn't provided us the specific url that's why I just post a generic answer to capture href
. See my below answer now. Used regex will be found here https://regex101.com/r/pnfz7E/1
$re = '/<a href="([^"]*?\/n\/\?confirm\.php)">.*?<\/a>/m';
$str = '<a href="https://www.website.com/n/?noconfirm.php">SSD</a>
<div>How are you</div>
<a href="https://www.website.com/n/?confirm.php">HDD</a>
<h2>Being Sunny</h2>
<a href="https://www.ltmgtfu.com/n/?noconfirm.php">MSD</a>
<div>How are you</div>
<a href="https://www.website.com/n/?confirm.php"></a>
<h2>Being Sunny</h2>
<a href="https://www.google.com/n/?noconfirm.php">GSD</a>
<div>How are you</div>
<a href="https://www.website.com/n/?confirm.php">LSD</a>
<h2>Being Sunny</h2>';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
print '<pre>';
print_r($matches);
print '</pre>';