You do not want to use regex to extract the url. I suggest using jQuery to execute an AJAX request, and then use jQuery to parse and filter URLs from HTML returned from the server.
jQuery.ajax({ url: "http://my.url.here", dataType: "html"; ... success: function(data) { jQuery("a", data).each(function() { var $link = jQuery(this); ... ... }); } ... });
If jQuery is not an option, you can do something like this when you get the answer:
var html = XHR.responseText; var div = document.createElement("div"); div.innerHTML = html;
source share