You might also be able to find a solution fromAI solution orcommunity posts

BFE.dev solution for JavaScript Coding Question
99. extract all anchor element from HTML string