I have a string like this:
'Hello, my name is <a href="https://stackoverflow.com/foo/bar">foobar</a>
My favorite food is <a href="https://google.com/food/pizza">pizza</a>'
I want to use javascript so all the html links to be replaced with markdown links like this:
'Hello, my name is [foobar](https://stackoverflow.com/foo/bar)
My favorite food is [pizza](https://google.com/food/pizza)'
How can I accomplish this? I know regex might be the answer but I'm not sure how to use it to solve my problem. Thanks in advance.