regex pattern to find example url from string [closed]

As Marty says, it all depends on which language you are using.
You could do it in JavaScript, like so:

var myString = "i have a example link:- https://www.google.co.in/search?q=web+service+urls&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=ex5iU-6CLMeW8QezvoCgAg i need a regex to extact that full url from text string. thanks!";
var myRegexp = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/
var match = myRegexp.exec(myString);

alert(match[0]);

Here’s a demo

I got the regex from this thread: JavaScript Regex to match a URL in a field of text

Leave a Comment