user1408470
user1408470

Reputation: 1515

Extract html img tag in a string in c#

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

Answers (1)

vks
vks

Reputation: 67968

<img\s(?=.*?\btest\b)[^>]*>

Try this.See demo.

http://regex101.com/r/wQ1oW3/31

Upvotes: 3

Related Questions