I want get only the starting html tags. Lets say I have html like this
<div class="some">Here is a sample text<br /><p>A paragraph here</p></div>
<ul><li>List Item</li></ul>
From the above html I want to extract this information
<div
<br
<p
<ul
<li
see I dont need ending ‘>’ of tags
Try regex
/<[a-zA-Z]+[1-6]?/g. I added the[1-6]for the header HTML tags – I think they’re the only ones with numbers. If you wanted to be sure you could do/<[a-zA-Z0-9]+/g, since in HTML a<is always a tag (unless it’s a comment<--), because in-line<get converted to<.