Bookin Bookin - 9 months ago 26
Javascript Question

Get tag if src have value

I use this:


So I need remove img, if src have special url, but problem with html like this:

<img src=""/>
<p>Text text text</p>
<img src=""/>

Will be remove all tags, but I need only last img tag.

Example -

Answer Source

Instead of using [\s\S] which means anything you can use [^>]:


See it live