1
votes

I was hoping someone may be able to help with the following issue I have.

I have a 'HTTP Request' sampler that makes a POST request. The response data for this request as per the results tree is:

<script>window.document.location.href='handler.ashx?act=wzfin\x26req=nav\x26mop=requirements!new_finish_wiz\x26pk=0c86ea74-c067-4bcf-a49d-be7d0e420fbf';</script>

I want to grab the value for the pk parameter in the response URL above and store in a variable called REQUIREMENT_ID. I have set up a 'Regular Expression Extractor' for the sampler and set it up as per below:

  • Apply to: Main Sample Only
  • Field to Check: Response message
  • Reference Name: REQUIREMENT_ID
  • Regular Expression: (?<=pk=)(.*)(?=\')
  • Template: $1$
  • Match No: 1
  • Default Value: NOT_FOUND

However, when I run this, NOT_FOUND is being returned. Any ideas what I might be doing wrong?

`Regular Expression Extractor screenshot

2

2 Answers

1
votes

Change your regular expression to this <script>.+pk=(.*?)'

And change your field to check to Body

enter image description here

0
votes

Try this: ".pk=(.?)'"

Not to sure why you way doesn't work to be honest.