JS怎么用正则表达式替换下面的超链接
将<tdwidth="87%"><ahref="gbtrs_ShowZwxx.asp?ZwxxId=207114"target="_blank">Content</a>&...
将<td width="87%"><a href="gbtrs_ShowZwxx.asp?ZwxxId=207114" target="_blank">Content</a> </td>替换成<td width="87%"><a href="http://121.28.50.102:8080/hbjproject/zwxx/showdata2.jsp?id=207114" target="_blank">Content</a> </td>
要求保持ID不变 展开
要求保持ID不变 展开
展开全部
var text = "<td width=\"87%\"><a href=\"gbtrs_ShowZwxx.asp?ZwxxId=207114\" target=\"_blank\">Content</a> </td>";
var regex = new RegExp("<a href=\"(?:(?!id=).)*","gi");
alert(text.replace(regex,"<a href=\"http://121.28.50.102:8080/hbjproject/zwxx/showdata2.jsp?"));
var regex = new RegExp("<a href=\"(?:(?!id=).)*","gi");
alert(text.replace(regex,"<a href=\"http://121.28.50.102:8080/hbjproject/zwxx/showdata2.jsp?"));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询