Don't use Regular Expressions to extract HTML data. See RegEx match open tags except XHTML self-contained tags for details.
JMeter offers 2 Post Processors designed for dealing with HTML data.
XPath Extractor
Add XPath Extractor as a child of the request which is returning your port data configured as follows:
- Reference name: anything meaningful, i.e.
port
. It'll be variable or variable prefix for matches results
- XPath query:
//select[@name='fromPort']/option/text()
- Important: if your response is not XML/HTML compliant - check
Use Tidy
box, it enables XPath Extractor to parse invalid XML/XHTML responses.
The output will be like:
port=Acapulco
port_1=Acapulco
port_10=Zurich
port_2=Frankfurt
port_3=London
port_4=New York
port_5=Paris
port_6=Portland
port_7=San Francisco
port_8=Seattle
port_9=Sydney
port_matchNr=10
CSS/JQuery_Extractor
Another options is using CSS/JQuery extractor which allows using CSS and/or JQuery expressions to fetch interesting parts of the response.
For example, if you're looking for random port following configuration may be helpful:
- Reference name: again, something meaningful, for instance
port
- CSS/JQuery expression:
select[name=fromPort] > option
- Attribute:
value
Hope this helps.