I am getting response from Jmeter like this:
<input type="hidden" id="queueItemId" name="queueItemId" value="3256"/>
I wanted to get value 3256 from this and store it in a variable. Then i can use this variable further use like ${variable}
.
For this i am using RegularExpressionExtractor
in scope of the Sampler.
Please give me the regular expression to extract this value.
Here is the XPath query:-
//input[@type="hidden"][@id="queueItemId"][@name="queueItemId"]@value
Better than using regular expression to extract that value I would suggest using XPath Extraction like this:
Where
MyForm
is your form name, replace with whatever you have.Actually the best awnser is from Ibu in the comment:
value=\"(\d+)\" and: value="([^"]+?)" will workfine too
So in jemter it will look like this:
If you want only the value that have the reference name queueItemId you might want to modify the reg ex to this.
So from jmeter reg ex extractor you got :
You should check the regex with jakarta oro because it's the reg ex engine that jmeter use.
Check out jakarta ORO here : http://jakarta.apache.org/oro/demo.html
ORO is a reg ex tool that behave almost exactly like jmeter.
Most of the time the the standart reg ex tool will work but it has happened to me sometime that the reg ex was fine in my tool but was not working in jmeter.
I later found out the ORO tool and was able to make it work in oro (and jmeter)
Another note: I think jmeter ignore space in your reg ex you have to add /s when you want to compare a space.
The most maintainable way in recent version of JMeter is to use CSS/JQuery Extractor:
The most performing one is to use new Boundary Extractor:
If you really want to use Regular_Expression_Extractor :
or try this code regexId = '\d+';