html code
<span id="nameDomain">gmail.com</span>
How to take the field values in Regular Expression extractor of jmeter
What i have to give
Regular Expression: Template: Match No.(0 for Random):
You can check the below example to extract the value.
You need to use ${spanval}
in the subsequent requests to access the value you have extracted.
Check this: JMeter - Regular Expression Extractor
In general using regular expressions to parse HTML isn't a very good idea as regular expressions are very sensitive to markup change and very fragile.
You can use XPath Extractor instead.
Add XPath Extractor as a child of the request which returns that "span" and configure it as follows:
Use Tidy
box if response is not XHTML-compliantnameDomain
//span[@id='nameDomain']/text()
Refer extracted value as ${nameDomain}
where required.
See XPath Tutorial for language reference and Using the XPath Extractor in JMeter for some more details.
If you still want to use Regular Expressions, the relevant Regular Expression will be <span id="nameDomain">(\S+)</span>
and Template $1$
. Other fields (apart from the "Reference Name" may be left as they are.