http://@.cn.alibaba.com/athena/companyprofile/@.html
在一个页面中,有很多连接,有些在a标签里面,有些不在a标签里面。现在我想获取http://@.cn.alibaba.com/athena/companyprofile/@.html这个链接。
类似http://111.cn.alibaba.com/athena/companyprofile/111.html或者是http://222.cn.alibaba.com/athena/companyprofile/222.html
也就是说@的地方的变化的。

解决方案 »

  1.   

    @"(http://).+(.cn.alibaba.com/athena/companyprofile/).+(.html)"???????
      

  2.   

    http://([w-]+.)+[w-]+(/[w- ./?%&=]*)?不知道这么能否,对正则真没信心。- -
      

  3.   

    string strSql =@"http://{0}.cn.alibaba.com/athena/companyprofile/{0}.html";
    然后拼合字符串
    return string.Format(strSql, "你想拼合的字符串");
    如:
    return string.Format(strSql, "111");
    返回
    http://111.cn.alibaba.com/athena/companyprofile/111.html
      

  4.   

    一楼的可以哦。不多得多测试一下。
    那位算法达人能用kmp算法show出来看看?
      

  5.   

    http://(\d+).cn.alibaba.com/athena/companyprofile/(\1).html---------------------------------
    http://111.cn.alibaba.com/athena/companyprofile/111.html   is   match
    Group[0]=http://111.cn.alibaba.com/athena/companyprofile/111.html
    Group[1]=111
    Group[2]=111
    http://222.cn.alibaba.com/athena/companyprofile/222.html   is   match
    Group[0]=http://222.cn.alibaba.com/athena/companyprofile/222.html
    Group[1]=222
    Group[2]=222
      

  6.   

    @"(http://).+(.cn.alibaba.com/athena/companyprofile/).+(.html)"
      

  7.   

    前后两处的内容有必然联系吗?小数点的范围太大,在同一行的两个链接会被取到一个结果中
    另外就是链接中的小数点要进行转义处理
    (?i)http://[^\s/]+\.cn\.alibaba\.com/athena/companyprofile/[^.\s]+\.html
      

  8.   

    http://(\w+)\.cn\.alibaba\.com/athena/companyprofile/(\w+)\.html