I have a regex to remove empty tags HTML, like <p></p>
or <span></span>
, but inside them I can have images and I want to ignore the tag <img>
. My regex:
(<(?!\/)[^>]+>)+(<\/[^>]+>)+
My uses cases:
I want to ignore the last line, because I have an image inside the tag.
Check the live editor: https://regex101.com/r/81M8VR/1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.