Question : How to match anchor tag which has ID attribute?
My string
<a href="something" id="someid" />
<a href="something" />
Expected output:
<a href="something" />
<a href="something" />
I need to delete id
attribute in anchor tags.
I tried so far :
<a(.*?)> //how to specify `id` should be in the captured group
Note: I have not used DOM parser for this, as it saves as HTML.
Check on this : https://regex101.com/r/cN9nR3/3
Expression : <a[^>]*(id="[a-z]*").*>
should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With