我想从URL中提取TLD,但它给了我整个URL。例如, -> .com.uk。
$(document).on("click", "a", function() {
var href = $(this).attr("href");
alert(href)// It gives me the whole link of website
if(href.search(".com.uk")){
alert("This website is AUTHENTIC!");
在我的web应用程序上,我查看当前的URL,如果当前的URL是这样的表单:
->我需要做的就是在另一个变量中提取由5个字母和5个数字(abcde16989)组成的ID以供进一步使用。
所以我需要这个:
var current_url = "the whole path, not just the hostname";
if (current_url has ID)
var ID = abcde16989;
我试图从一个网页中提取.com,.net和.org链接,其中包含不同数量的链接。我只是在学习使用C#的正则表达式,但我不确定如何设置一个模式来查找.com、.net和.org扩展。然后打印那些带有这些结尾的urls。任何建议或网站,你可以指导我帮助我将是伟大的。
这是我到目前为止所得到的
WebClient client = new WebClient();
string extPattern = @"?.com|?.net|?.org; //but i think i am not doing this right.
string source = client.Dounload