I have this response in HTTP request as below
href="index.php?module=Meetings&action=DetailView&record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac">
I want to get the value of "record", but when I set
Regular Expression : record=(.+?)
only "e" is returned. What do I need to do instead?
Let us understand the use of Regular expressions in the Regular Expression Extractor—a Post-Processor Element by writing a test plan. This element extracts text from the current page using a Regular Expression to identify the text pattern that a desired element conforms with.
It allows you to set a left boundary value for the string being verified. “Right boundary” does the same as the previous field but from the right side. “Match No.” allows you to set an index for the found value if many values were found by the given criteria.
The value(s) which is extracted can be stored in any variable and can be a reference in any further request in the test plan. Values can be extracted from the response body, header, URL, response code, and other provided fields when you add this processor.
The JSR223 postprocessor allows you to use precompiled scripts within test plans. The fact that the scripts are compiled before they are actually used brings a significant performance boost compared to other postprocessors.
Well the regular expression consumes as little as possible (due to the ?
). Hence, it is satisfied after taking in the first character. You should probably rather make it greedy and restrict the possible characters (so that it cannot go past the end of the parameter):
record=([a-f0-9-]+)
If you do not know which characters are allowed as the parameter's value, you could also say, consume everything but ampersands and quotes:
record=([^"'&]+)
Depending on where you use it, you might need to escape one of the quotes with a backslash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With