Reputation: 1515
I have a html code as a string. I need to remove the img tag in that which has a particular src attribute.
e.g. <img style="WIDTH:439px;" src="http://test/a.png">
Say I need to find img tags which has "test" src attribute and remove the entire img tag from the string.
Thanks in advance
Upvotes: 1
Views: 2538
Reputation: 67968
<img\s(?=.*?\btest\b)[^>]*>
Try this.See demo.
http://regex101.com/r/wQ1oW3/31
Upvotes: 3