Link to home
Start Free TrialLog in
Avatar of jakkwylde
jakkwylde

asked on

Regular Expression - Matching Select Tags w/ Option List in HTML

I have a regular expression that I have to find blocks of all html select lists, such as the following:

<select name="test>
<option>Test1</option>
</select>

My regular expression is: <SELECT[^>]*>(\w|\W)*(</SELECT>?)

The problem with this is that it matches anything from the top select tag down to the very last one, thus my result set can have a multitude of other information if there are multiple dropdown boxes on the same page.  

How can I make it stop on the first occurance of a closing select tag ("</SELECT>") rather than parsing the rest of the content through the last instance of the </SELECT>?  I've tried a bunch of things, but no luck.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jakkwylde
jakkwylde

ASKER

That did the trick, thanks for the quick response!