16574

Looping through multiple Regex extractor output

Question:

Can you please tell me how to loop through the result of a Regex Post Processor that returns multiple values?

Example:

JSON Response message:

{ "reply": { "code": "111", "status": "SUCCESS", "customerID": [ "222-a", "b-333", "44-4", "s-555", "666", "777", "88-8" ] } }

Regx extractor helped me extract each individual component of the array:

links_1=222-a links_2=b-333

I can use some.url/${links_1}.<br /> Here is exactly what I am trying to achieve, but this does not seem to work.<br /> Can you please help me?

Loop through the Regex extracted individual variable using a counter and append each one in another HTTP request sampler:

WhileController(${__javaScript(${C} < ${links_matchNr})}) HTTPSampler use ${__V(links_${C})} Counter (start=1,increment=1,maximum=${links_matchNr},referenceName=C)

Answer1:

Use <a href="http://jmeter.apache.org/usermanual/component_reference.html#ForEach_Controller" rel="nofollow">ForEach Controller</a>:

<ul><li>

input variable : links

</li> <li>

output variable : link for example

</li> </ul>

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/iIYSX.png" data-original="https://i.stack.imgur.com/iIYSX.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

You can then use each value inside Controller through:

<blockquote>

${link}

</blockquote>

Answer2:

I have created this tutorial, <a href="http://goo.gl/4cBno" rel="nofollow">http://goo.gl/4cBno</a> I hope its useful. To view the desktop sharing clearly, click on the full screen icon at the bottom right.

Recommend

  • adding jar in Jcreator
  • gradle.buildStarted not triggered
  • Weird problem about Java Generics operation
  • How to append distinct records from one table to another
  • Fibonacci Computation Time
  • Index on every Foreign Key?
  • How to get the percentage of my brute forcer?
  • Copying files and creating new folders based on “creationdate”
  • strtotime returns incorrect timestamp for '-1 month'
  • google-apps-script count files in folder
  • Encoding CV_32FC1 Mat data with base64
  • -[__NSArrayM insertObject:atIndex:]: object cannot be nil
  • Escape exclamation mark in batch file
  • Catching exception and throwing the same?
  • How to extract a number from a string [duplicate]
  • Convert C# statements including NSubstitute code to VB.net
  • mapping between two ontologies
  • R h2o.glm - issue with max_active_predictors
  • get all processes in parallel
  • How to use the resource module to measure the running time of a function?
  • Cannot invoke my method on the array type int[]
  • Lua: Line breaks in strings
  • Google Places API - Find a company's CID and LRD
  • Iron Router: How do I send data to the layout?
  • How VBA declared Volatility works
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • Converting a WriteableBitmap image ToArray in UWP
  • Typescript - Unable to get 'import' statement to function
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Updating server-side rendering client-side
  • How to handle AllServersUnavailable Exception
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Circular dependency while pushing http interceptor
  • AngularJs get employee from factory
  • Benchmarking RAM performance - UWP and C#
  • How to set the response of a form post action to a iframe source?
  • Angular 2 constructor injection vs direct access
  • Change div Background jquery
  • IndexOutOfRangeException on multidimensional array despite using GetLength check