求!DW网页正则表达式替换公式

把网页所有以下代码,如:

第一个:
<a trace="auction" tracenum="2" href="http://item.baidu.com/ite" target="_blank" title="百度知道" data-spm-anchor-id="a230r.1.14.341">
第二个:
<a trace="auction" tracenum="2" href="http://item.baidu.com/i31" target="_blank" title="百度知道2" data-spm-anchor-id="a530r.2.17.341">
一直到几十个。。。。。

全部替换成<a>

怎么用正则表达式表达【】里面的内容?
<a trace="auction" tracenum="2" href="【http://item.baidu.com/ite】" target="_blank" title="【百度知道】" data-spm-anchor-id="【a230r.1.14.341】">

【要来成品哦!直接能用的!谢谢了】

不是太清楚你的情况,如果此页面没有其它的A标签的话<a[^>]*>替换成<a>就行了,它会把所有A标签替换掉的
如果只想匹配这种属性形式的A标签<a trace="[^"]*" tracenum="[^"]*" href="[^"]*" target="[^"]*" title="[^"]*" data-spm-anchor-id="[^"]*">替换成<a>

想捕获某个属性值的话,把那个值加上括号,在替换框里用$1-$n替换就行了
如:<a trace="[^"]*" tracenum="[^"]*" href="([^"]*)" target="[^"]*" title="([^"]*)" data-spm-anchor-id="([^"]*)">替换成<a href="$1" title="$2" data-spm-anchor-id="$3">
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答