I will be writing a program where I just read a jsp file line by line and using regex check if there are any select
tags in the page. If they are then I want to extract the data between <option>DATA</option>
tags.
I wrote the following regex here at regex101.
(?:<select.*>\n?\s+(.*<option.*>$.*)\n?\s+<\/select>.*)
Those who are not aware about regex101, you can also see the java code for the regex using sidebar at top left.
Problem is regex is not matching any thing for the string:
<select name="javaType">
<option value="boolean">boolean</option>
<option value="byte">byte</option>
<option value="char" selected>char</option>
<option value="double">double</option>
<option value="float">float</option>
<option value="int">int</option>
<option value="long">long</option>
</select>
I want to extract the data between tags. I know my regex is incomplete but I have no clue on how I should proceed on this.
Do I parse line by line and check for select tag first, then again check for tags? Or is there a better way using regex?