0
votes

I have to extract 5 different dynamic values in Jmeter,four are always numbers while the other one is alpha-numerical as shown below with no boundaries (the response is as as shown)

Incharge 1  DL0413  1   6   1   1

I used \t[0-9]\t[0-9]\t[0-9]\t[0-9] & Template as $0$ as a regular expression (in Regular Expression Extractor) to extract the four numbers, this highlights the numbers in the View Results tree when checked but I am unable to pass these in the following request.It passes all 4 numbers as one - 1611

Also used DL[0-9][0-9][0-9][0-9] to get the first alphanumeric data which has worked for me. But I was looking for more robust extractor which could work for all the values

1
i do not understand your example. i see 6 fields. that is your input and how does your required match look like? - vlad_tepesch
"Incharge\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)" should work.output will be \1=1, \2=DL0413, \3=1 till \6 which is 1 again - Nachiket Kate
@vlad_tepesch Incharge 1 is one identity which is not required but it is also dynamic - Paras

1 Answers

0
votes

Configure your regular expression extractor as follows:

  • Reference Name: anything meaningful, in my case it will be test
  • Regular Expression: Incharge\t(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)\t(.+?)

It'll match all the elements separated by tabulation as

Regex tester

If you add a Debug Sampler to your test plan and look into it in View Results Tree listener you'll see that all match groups are there as JMeter Variables:

Debug Sampler

So you can refer:

  1. First 1 as ${test_g1}
  2. DL0413 as ${test_g2}
  3. Second 1 as ${test_g3}
  4. 6 as ${test_g4}
  5. etc.

See How to debug your Apache JMeter script for more information on approaches of debugging a flaky JMeter script.