I am using php and regex to find unclosed html tags in a string :
This is my string :
$s="<div><h2>Hello world<h2><p>It's 7Am where I live<p><div>";
You can see All tags here are not closed.
I want to find all unclosed tags, but the problem is that my regex is matching opening tags also.
Here is my regex so far
And this is my preg_match_all() function
What do I need to change in my regex to match only the unclosed tags?
<h2> <p> <div>