Google-sheets – How to get URL from Block Text in Cell in Google Sheets

google sheets

I have a Google Sheet with Text in A1:

Welcome to my Website!

Visit some Amazon Products: https://amzn.to/3o7UGKS

King regards!

So what I'm looking for is how to get the link Amazon Link from the text in cell A1 in B1?
B1 should be:

https://amzn.to/3o7UGKS

Best Answer

You can try this:

=REGEXEXTRACT(SUBSTITUTE(A1,CHAR(10),"@"),"(http[^~]+)@")

This formula assumes that your line breaks are caused by ASCII character 10.