0
votes

I am new to jMeter. I am recording a script for creating a shift. For every transaction New shift ID is generated. I have tried to extract it by using regx Exp extractor but not getting anything. Pls see below information.

*Reference Name: strgenShiftId

Regular Expression: end="${strWeekEndDate}" gs="(.+?)"

Template: $1$

Match No.

Default Value:

Where ${strWeekEndDate} is a variable which extracts the date from some other previous response.

My Response code is as following-

week start="07/27/2015" end="08/02/2015" gs="61530" unitSkey="811" fy="2015" fw="30" ac="Y">

I want to extract the gs="61531".

The full response is:

<data>
<weeks selWkIndex="5">
<week start="06/29/2015" end="07/05/2015" gs="71526" unitSkey="811" fy="2015" fw="26" ac="N">
</week>
<week start="07/06/2015" end="07/12/2015" gs="71527" unitSkey="811" fy="2015" fw="27" ac="N">
</week>
<week start="07/13/2015" end="07/19/2015" gs="71528" unitSkey="811" fy="2015" fw="28" ac="N">
</weeks>
</data>
1
Can you paste your code as is? - Shawn
@Shawn Please find following response - <data><weeks selWkIndex="5"><week start="06/29/2015" end="07/05/2015" gs="71526" unitSkey="811" fy="2015" fw="26" ac="N"></week><week start="07/06/2015" end="07/12/2015" gs="71527" unitSkey="811" fy="2015" fw="27" ac="N"></week><week start="07/13/2015" end="07/19/2015" gs="71528" unitSkey="811" fy="2015" fw="28" ac="N"> - abhishek
I added your output to your question for readability. Thanks. - Shawn
Add a debug post processor in order to be sure that the value of strWeekEndDate is what you are expecting. - JusMe

1 Answers

1
votes

You can extract gs value using following regular expression: gs=\"([^"]+)\". Always remember to escape " with \ in regular epressions, unless you want " to be evaluated as part of regular expression.