This code will take an input string and return a list of urls found within that input string using regular expressions.
* Place this code in a separate JS file.
function regex_list_matches_pattern_urls(inputString)
{
var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
var regex = new RegExp(expression);
return inputString.match(regex);
}