问题:如何匹配具有ID属性的锚标签?
我的弦
<a href="something" id="someid" />
<a href="something" />
预期产量:
<a href="something" />
<a href="something" />
我需要删除id
锚标记中的属性。
到目前为止,我尝试过:
<a(.*?)> //how to specify `id` should be in the captured group
注意:我没有为此使用DOM解析器,因为它另存为HTML。
检查一下:https : //regex101.com/r/cN9nR3/3
表达:<a[^>]*(id="[a-z]*").*>
应该这样做。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句