Regular Expression Extractor is a post processor in JMeter which is used to extract dynamic values from a server's reponse. For the most part, we have seen atleast one of the parameter boundaries (i.e. the left boundary or the right boundary) alongside our parameter which made it easy for us to derive our regular expressions.
Let us consider a scenario where we have to extract a parameter that doesn't have any other character in the same line as our parameter. In our screenshot below, the parameter to be extracted is 1662.
Regular expression extractor does support multi-line mode and there is an impact of newline & tab characters in our case. A regular expression can be derived in many ways. We came up with a very simple expression <strong>\n\n\n\n\n\t\t\t\t(.*?)\n</strong> and yes it worked like a charm.
We used the RegExpn Tester in the Tree View listener to test our regular expression directly on sampler's response data.
Note : We could also use third party websites to test Java regular expressions. Another approach is to use a simple test plan with a Debug Sampler and a Tree View listener. The jp@gc - Dummy Sampler can be used to generate the required sample data. Any changes to the regular expression can be tested quickly without any hassle.