Search code examples
regexjmeterperformance-testing

How to extract multiple values with a regular expression in Jmeter


I am running tests with jmeter and I need to extract with a Regular Expression:

insertar?sIws2kyXGJJA_01== 
insertar?sIws2kyXGJJA_02==

in the following String:

[\"EMBPAGE1_00010001\",\"**insertar?sIws2kyXGJJA_01==**\",1,100,\"%\",300,\"px\",0,\"center\",\"\",\"[\"EMBPAGE1_00010002\",\"**insertar?sIws2kyXGJJA_02==**\",1,100,\"%\",300,\"px\",0,\"center\",\"\",\"

Solution

  • Use super secret operator (Negative match N)enter image description here

    UPD: G2 - is in my example, as I extract two groups from each encounter. each encounter is "uuid" in g1 and g2 is second part I need second part here. that's why $2$ template and g2. If your encounters in one group you ll most likely use $1$ template that will place all encounters into g1. If you have one match group you don't actually need _gN ending at all. To understand more the variables after group extraction add a "Debug PostProcessor" and inspect output in TreeView.

    It nice two know that control elements like "For each" understand groups and can work with prefix like regexUUID_ and walk through. In most cases it's next you do after extraction.

    UPD2. primitive version of regexp in question (insertar\?sIws2kyXGJJA_\d*)==([^[]*) with template $1$$2$ you ll have the first parts in g1 group and the second parts in g2