Need to extract the value of the red box _id, the entire return has a number of similar curly brace objects: The value of the first ID inside, but the entire JSON string is more than one, and only match quality_level is the value of the first ID in this curly brace of 349. Here are 3 ways to do it:The first: The Stupidest method, all fields are written out to make a match{"_id": "(. { 10,30}?) "," Agent ": {" _id ":" [^ "]*?", "Name": "[^"]*?}, "category": {"_id": "[^"]*? "," Name ":" [^ "]*?}," Create_time ": [ ^ "]*," duration ": [^"]*?, "End_time": [^ "]*?," is_resolved ": [^"]*?, "is_inspected": [^ "]*?," Inspector ":" [^ "]*?", " Inspect_time ": [^"]*?, "Location": "[^"]*? "," Quality_level ": 349the regular is to write out all the fields from the first ID to the quality, each matching the field. Because the values in each field are definitely not enclosed in double quotes, an expression that excludes double quotes is used [^ "]. This guarantees that each field will match only his original value, and that there will be no excessive matching of other content. This is the stupidest way. The second type: The most change based on the first type\{"_id": "(\w{24})", "Agent": \{[^{}]+?\}, "category": \{[^{}]+?\}[^{}]+? " Quality_level ": 349,This regular uses the expression of the filter brace [^{}], because we see that so many JSON strings are separated by curly braces, so I just let my expression do not match the curly braces, that is, the matching content can not have curly braces to the entire range of the position into a curly brace , however, because the agent and the category have curly braces, so I can only put their 2 curly braces first to match out, and then in their 2 parentheses to match the content without curly braces. The third type: Use does not contain certain specified word syntax{"_id": "(. { 10,30}?) "," Agent "(?:(?! Agent).) *, "Quality_level": 349This regular uses a matching grammar that does not contain a single occurrence.(?! Agent). This expression is to match each string before the inclusion of the agent, contains false, only the character before the agent is true, so that I can add an asterisk (*) to the expression, so that he to match each, "agent" after the content, Only the content that does not contain the agent can match to, this can guarantee my ID to quality inside will have only one agent. It just matches the contents of one curly brace .Of
course, similar to the JSON string return value to extract, you can directly use JSON parsing, it is more convenient
jmeter--the value of another field that extracts the specified field value in a curly brace object in a JSON string