I'm using the Flickr public API to build a small Express and React app. It returns a 'description' which is a string of HTML:
<p>
<a href="URL">martin_king.photo</a> posted a photo:
</p>
<p>
<a href="URL_IMAGE" title="Potato Planting 2018 | FENDT // REEKIE">
<img src="URL_IMAGE" width="240" height="160" alt="DESC_PHOTO" />
</a>
</p>
<p>
FENDT 412 Vario TMS with the REEKIE ScanStone Separator <br/><br/> Follow Us: <br/> •
<a href="URL" rel="nofollow">Facebook - DYNASTYphotography</a> <br/> •
<a href="URL" rel="nofollow">Lukaskralphoto Instagram</a><br/> •
<a href="URL" rel="nofollow">my personal Instagram</a><br/> •
<a href="URL" rel="nofollow">YouTube Channel</a>
</p>
The first a
tag there contains the link I need, I just need some help writing a function/RegExp that can help me extract it. This is my intended result:
getFirstLinkFromDescription = string => ... // 1st 'URL'
Thanks for any help!