0

I need to extract URL from a given text. the URL can be in any format.with or wothout query string,with or without http:// ,https://,www. etc..

This is what i have so far

var mystrings = new Array;

        var text = $('#description').val();

        var re = /(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi;


        while (matches = re.exec(text)) {
            mystrings.push(matches[0]);
        }

        console.log(mystrings);
xoanon
  • 195
  • 1
  • 10

0 Answers0