Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use jmeter regular expressions

Shulou Source: shulou.com Published: 2022-06-02 07:10:29 10月30日 Update

This article mainly explains "how to use jmeter regular expressions". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use jmeter regular expressions.

By using the Jmeter regular extractor, the desired content can be obtained from the response result of the request, thus the correlation can be realized.

Association means that there is a data dependency between the request and the request, and you need to get the data that the next request needs to send back from the previous request.

To find the corresponding data in the view result tree, we need to get the actionId,buttonName

You need to select the request right button and add-post processor-regular expression extractor (on which request you need to get it in the response data of the request. The post processor means that the request is executed first and then fetched from the response data)

As shown in the figure above, this is the property of a regular expression. First, briefly introduce the meaning of the following field, and then give an example.

Name: just write one yourself.

Apple to: and the corresponding fields to be checked are generally defaulted. They are mainly processed for the values in the response data. For other needs, please refer to the jmeter description.

Reference name: the name of the variable defined by yourself, and the name of the variable to be referenced in subsequent requests, such as: actionId, followed by ${actionId}

Regular expression: a regular expression that extracts content, equivalent to an association function in lr

[the part enclosed by "()" needs to be extracted, and the content you want to mention needs to be enclosed in parentheses]

[".": matches any character except a newline character]

["*" (greedy) repeat zero or more times, for example, "aaaaaaaa" matches all a regularities in the string: "a *" will go to all characters "a"]

["+" (lazy) repeat one or more times for example, "aaaaaaaa" matches all a-regularities in the string: "a +" takes all a characters in the character, "a +" differs from "a *" in that "+" is at least once while "*" can be 0 times]

["?" (possession) repeat zero or once, for example, "aaaaaaaa" matches the a-regular string: "a?" It will only match once, that is, the result is only a single character a]

["*?" Repeat any number of times, but repeat as few times as possible, for example, "acbacb" regular "a. Acb" will only get the first "acb", but when a qualifier is added, it will only match as few characters as possible, and the result of the minimum number of characters of "acbacb" is "acb"]

["+?" Repeat one or more times, but as little as possible, with "*?" The same, but only to repeat at least once] there are also grouping cases, these are the only two commonly used, and the others can be used on their own Baidu.

["(? = exp)" matches the position in front of the exp]

["(?

Tags: Regular expression character content data that is number result more two representatives variable name string whenever possible case sampler association processing learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft MariaDB vpn Shulou Information