I’m working with an application that handles the submission and processing of filings, and I’m trying to perform a load test where different users target different filings and perform different actions depending on the filings’ status. This information exists within an incredibly long JSON response that is sent from the server, which also contains all the information on all the filings. It is particularly convenient, however, that the fields I’m interested in are close enough to each other to try to correlate them.
The way I’m going about this is the following: I need to extract each filing’s ID number in order to target it, and I need to be able to randomly target filing IDs that are associated with a specific status. The structure of the response that I care about is as follows:
{
"responseObject":{
"baseFilingRequests":{
"^Value":[
{"fields":"[values]"},
{"fields":"[values]"},
{
"fields":"values",
"referencedListings":"[value]",
"id":"[value]",
"referenceId":"[value]",
"status":"[value]",
"filingName":"[value]",
"fields":"values",
},
{"fields":"[values]"},
{"fields":"[values]"}
]
}
}
}
So I figured I could just stick this expression in the RegEx and modify the status field for each thread group so each would target filings with a different status (STATUS_APPROVED, STATUS_REJECTED, and so on), and then just extract the ID of each filing it finds, using an expression like this:
\"referencedListings\":null,\"id\":\"(.+?)\",\"referenceId\":\"\d\d\d\d\d\d\d\”,\"status\":\"STATUS[_]RECEIVED\",
However, the underscore is giving me trouble when trying to extract IDs of filings with the status I specify. Sometimes it captures a different status (capturing a filing ID that corresponds to a filing with a STATUS_CANCELLED status, instead of the STATUS_LOCKED that I specify), sometimes it captures an ID but it doesn't stop extracting there; it extracts as much of the response that comes after it as it can, inserts this massive string in the variable, and then attempts to use that as a filing ID in my later requests, generating null pointer exceptions. This behavior is erratic and seemingly random, and I am at a loss as to how to solve this.
I’ve tried escaping the character using backslashes, and just about every other syntax I’ve been able to think of, but this behavior persists. It is the underscore without a doubt because whenever I try the expression using only everything that comes before the underscore, the RegEx behaves consistently and predictably. But I can’t just omit it, because it’s part of the syntax of the status that I need to detect so I can filter filings accordingly, more so when statuses like STATUS_PENDING_UNLOCK contain two underscores and I need to be able to detect both.
Any insight on this matter would be greatly appreciated.