JMeter Regular Expression extractor--association

Source: Internet
Author: User

http://desert3.iteye.com/blog/1394934

1, http://www.cnblogs.com/quange/archive/2010/06/11/1756260.html

2, Http://blog.csdn.net/zhangren07/archive/2010/10/15/5944158.aspx

<input type= "hidden" name= "Hidname" value= "(. *)" >//Extract values of hidden fields in HTML


^ (. *) $//Extract entire response return


<input value= "(. +?)". *\n.*my Label//extract the value of My label associated input

<input value= "RADIO43" type= "Radio" name= "MyRadio" id= "Long_nested_path"/>
<label for= "Long_nested_path" >my label</label>

"(. +:create:.+?)" Extract the value of the href below link
<a href= "? Wicket:interface=:4:create::ilinklistener:" >


Jsessionid= (. *); path=///Fetch the value of the cookie Jsessionid from the response headers
Set-cookie:jsessionid= (. *?); Grab Jsessionid from headers, not greedy


Using the JMeter regular extractor, you can get the required content from the response result of the request, and then implement the association. Essentially, it is implemented using the extraction pattern of regular expressions.

The following is a brief introduction to how the JMeter regular expression extractor is used.

1. Add jmeter Regular expression extractor: add jmeter Regular expression extractor under specific request (JMeter regular expression under "Post processor")
2. JMeter Regular Expression Extractor Control Panel, as follows:



Position 1: Name and comment
Position 2: The regular expression extracts the range of content. (For a detailed description of each field, please refer to the relevant instructions for the agreement)
Location 3: Related settings for regular expression extraction

    • Reference name: The name of the variable that references the extracted value elsewhere, such as: STR, the specific reference is ${STR}
    • Regular expression: the regular expression for extracting content "a little attention: () means extraction, for you want to advance the content needs to be enclosed in parentheses"
    • Template: With $$ reference, if there is more than one extraction expression in the regular expression (more than the parentheses in the east), then it can be $1$,$2$ and so on, representing the value of the parse to STR, the regular expression of the extraction mode, the value starts at 1, the value 0 corresponds to the entire matching expression, such as for the expression s (. *) value 0 corresponds to str, value 1 corresponds to TR
    • Match numbers (0 for random): 0 for random, 1 for all, and the remaining positive integers to represent what will be in the extracted content, the first few matches.
    • Default value: The value to be taken when the regular match fails


1, in the process of using the regular expression extractor, if the match number is selected-1, you can also use ${str_1} to take the 1th matching content, ${str_2} to take the 2nd matching content.
2, about the regular * and * is not the same, in the above example using the regular <title> (. *?) </title> or Regular <title> (. *) </title> are all possible. This is the greedy and non-greedy pattern in the regular.

JMeter Regular Expression extractor--association

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.