I want to remove img
tag from an HTML string, but when I used regexp to match the img
tag with ">" in the attribute value of the img
, it always match the wrong substring.
Here is a case:
var str = '<img src="test>test" alt="test > test test" > "some text';
var reg = ???
How to make '<img src="test>test" alt="test > test test" >">'.match(reg)[0] === '<img src="test>test" alt="test > test test" >'
Tried this regexp /<\s*(img)[^>]+(>[\r|\n|\s]*<\/\1>|\/?>)/
, but not worked.