0

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 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

3 Comments

yes, thank you! I think this is the way it should work, too. But my response assertion, now for the variable ${regex_1}, is still null...
no ${regex} ${regex_1} and ${FOO} are working properly. I am stuck.
@Leder see updated edit. Perhaps your missing something, this works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.