$str = '32423423432<A href=\"http://news.tongji.edu.cn/UploadFile/biaoge.doc\">http://news.tongji.edu.cn//UploadFile/biaoge.doc</A>),9月27日学校组织专家对申请材料进行评审<A href=\"http://news.tongji.edu.cn/UploadFile/biaoge.rar\">http://news.tongji.edu.cn//UploadFile/biaoge.doc</A>,并根据评审情况确定留学候选人员名单,候选人员在9月30日之前进行网上申报,同时向受理机构(出境管理科)提交按国家留学基金全额资助项目要求准备申请材料一式二份(原件一份,复印件一份),(有关申报材料和操作方法详见<A href=\"news/gb/readarticle/readarticle.asp?articleid=2152\">http://www.csc.edu.cn</A>';如何把上面那串字符串中的  超链内容中包含doc rar的去不替换成空呢?还有我只要替换href开头是news下的超链

解决方案 »

  1.   

    href开头是news下的超链\"news...这种替换   , \"http://news...这种不替换?
      

  2.   

    不替换,只替换    \news\xx文件夹\xx.doc或者rar
    是整个超链全部替换成空
      

  3.   

    不如可以写个js,获取tag是A的元素,然后让其href值设置空。
    aElements = document.getElementsByTagName("a");
    循环遍历aElements,设置每个元素aElement.href值为空。