troubleshooting Question

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

Avatar of jakkwylde
jakkwylde asked on
Regular Expressions
2 Comments1 Solution213 ViewsLast Modified:
I have a regular expression that I have to find blocks of all html select lists, such as the following:

<select name="test>

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.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros