Disply link preview from text message

Is there a way to display a link preview in the body of a text/chat message even if the link itself is not the only content in the text?

Meaning if in one data entry of type text, that text holds a link also.

And also in a messaging feature, what’s recommended for knowing how to show a link preview if a text has a link in it? Or just the link itself?

Have a look to this post. It popped up as first result in a simple Google search

Yeah but is that a good method for a chat message that contains a link along with text? Wouldn’t regex be best for the scenario where a chat/text has a URL link in it, and then show the link preview under the chat/text. I know a plugin could be helpful for displaying the link preview, but what about extracting a URL link or multiple URL links from a text body?

Example:

Text message/chat:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. https://www.URL.com/link/path/path2 and then Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

That link preview in a text box below that: