Reputation: 392
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:
Unfortunately, when I add an Response assertion for the filed regex variable ${regex} I get null in the view results tree of the run.
How do I get the value of the regex variable apart from null?
Thanks Gerrit
Upvotes: 0
Views: 2900
Reputation: 70732
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
Upvotes: 2