Search code examples
regexjmeterextractor

Jmeter regular extractor default values when there are two or more templates


How to pass default values to Jmeter regular extractor when there are two or more templates.

In the screenshot below, I like to set the values for Code_Id_article_g1=""g1_default" and Code_Id_article_g2=""g2_default". Note: Since I am doing random extract to I don't want to split the regular exp ( I need the pair) Thanks

enter image description here


Solution

  • As of JMeter 5.5 you can create only one variable using Regular Expression Extractor and it will be Code_id_article having the value from the "Default value"

    You can consider switching to JSON JMESPath Extractor which allows creating 2 variables with 2 different default values or JSR223 PostProcessor where you will have the complete freedom regadring how many variables to create, how they will be called and what will be their default values.

    Moreover JSON is not a regular language and using regular expressions for parsing it is not the best idea.