0
votes

I have a regex Debug Sampler for printing the environment variable files of JMeter, system.properties etc.

Then I do a regex Extractor postprocessing as follows: regex extractor postprocessing

Unfortunately, when I add an Response assertion for the filed regex variable ${regex} I get null in the view results tree of the run. response assertion

How do I get the value of the regex variable apart from null?

Thanks Gerrit

1

1 Answers

2
votes

EDIT:

Using the Post-Processor > Regular Expression Extractor, it is simple to extract any portion of the response.

Since JMeter 2.4, the listener View Results Tree include a RegExp Tester to test regular expressions directly on sampler response data


You can use the following:

Reference Name: regex
Regular Expression: ([A-Z][a-z])
Template: $1$
Match No.: 1

The template is used to create a string from the matches found. This is an arbitrary string with special elements to refer to groups within the regular expression. So to refer to group 1, you would use $1$..

Use the corresponding variable to access the match. ${regex}

The variables are set as follows:

regex_matchNr - Number of matches found, possibly 0
regex_n       - (n = 1, 2, etc..) Generated by the template
regex_n_gm    - (m = 0, 1, 2) Groups for the match (n) 
regex         - By itself it is always set to the default value
regex_gn      - Not set at all