How to extract dynamic values with jmeter Regular expression extractor?



  • Please let me know how to fetch the ID from the html using a regular expression & find the below expression i have used but am getting error response only.

    Response Body:

    "input type="hidden" name="paymentId" value='234201921134768136' "
    

    Regular Expression:

    input type="hidden" name="paymentId" value="(.+?)" 
    

    Variable name : paymentId



  • If you really want to use regular expressions for this, here you go:

    input type="hidden" name="paymentId" value="(\d+)"
    

    Demo (assumes RegExp Tester more of the View Results Tree listener):

    enter image description here

    However be informed that using regular expressions for parsing HTML is not the best idea as regular expressions are very sensitive to markup changes and extra space or line break will ruin your regex.

    Consider going for CSS Selector Extractor instead, it allows using CSS Selectors for querying the document which is way more readable, robust and reliable

    enter image description here



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2