I have this string that contains html code :
String str ="<form action=''><span> First Name </span> <input type='text' id='fname' class='cls' size='40' required /> <span> [*]</span> <input type='submit' value='Submit' name='btn' /> <select name='slcEle' > <option value='opt'> Text</option> </select> <input type='radio' id='this'/> <button name='name' type='reset' value='val'> Text</button> <input type='range' min='0' max='100' name='grade'/> <button name='btnname' type='button'> Text</button>";
I want to split it, so that each html element be a separate string. The output could be array that contains this:
[0] =
<form action=''>
[1] =<span> First Name </span>
[2] =<input type='text' id='fname' class='cls' size='40' required />
[3] =<span> [*] </span>
[4] =<input type='submit' value='Submit' name='btn' />
[5] =<select name='slcEle' >
[6] =<option value='opt'> Text</option>
[7] =</select>
and so on.
I can't use split function because as you see there are different characters and pattern for each string.
Can anyone help with this?