I want to get a url from a string but I am unfamiliar with the use of regex or any such methods.
For example i have 3 strings,
- "I've navigated to www.facebook.com";
- "I've navigated to www.facebook.com and to www.google.com";
- "I've navigated to https://www.facebook.com ;
In my case : I should get "www.facebook.com" as the url that is extracted from the first string.
All I want is to get the first url inside the string so i can make a link preview using an API I found. But I am struggling to get the url using Javascript or Jquery. The string will be gotten from a textbox and I want to get the url on keyup.