'<a href="/link/someId">Page №{thisId}</a>'
<a href="https://toster.ru">Page №13</a>if(preg_match('/№\</',$yourstring,$matches) ){
// var_dump($matches);
if ($matches) {
делаете ваши дела
}