A Regular Expression to match opening and closing HTML tags with attributes.
/<\/?(\w+)(\s+\w+=(\w+|"[^"]*"|'[^']*'))*>/
Matches:
- <a>
- </p>
- <h1 class=”demo”>
Non-matches:
- ABC
- <a
- <h1 class=”demo”></h1>
A Regular Expression to match opening and closing HTML tags with attributes.
/<\/?(\w+)(\s+\w+=(\w+|"[^"]*"|'[^']*'))*>/