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.