Jmeter post processor, use of regular expression extractor

[Usage scenario]: The next request parameter needs to be obtained from the response data of the previous request

[jmeter regular expression description]: use perl regular expressions (refer to: http://www.runoob.com/perl/perl-regular-expressions.html)

【grammar】:

    The part enclosed in () is to be extracted.

    . matches any string.
    * means any number of characters 
    + one or more times.
    ? Don't get too greedy, stop after the first match is found.
    \d number
    \w number or letter
    {n} means n characters
    {n,m} means nm characters
    \s means whitespace
    [] represents a range, for example:
    [0-9a-zA-Z\_]  Can match a number, letter or underscore  
    ^     Indicates the beginning of a line, ^\d indicating that it must start with a number.
    $     Indicates the end of the line, \d$ indicating that it must end with a number.
    A|B  Can match A or B, such as (P|p)ython can match 'Python' or 'python'
    ()    Represents the group to be extracted, such as  m = re.match(r'^(\d{3})-(\d{3,8})$', '010-12345')
[Example description]:
1. Add a regular expression extractor, the parameter description is as follows:
  Reference name: as the literal meaning, the name used when calling in other places, calling method ${orderid}
  Open expression: Write a regular expression according to the grammar, the content in parentheses is the content to be matched (if you need to match multiple content, you can separate them with commas, such as: (.*?), (.+?))
  Template: $$ means that if you use that regular expression and that template to get the values ​​-1 all, 0 is random, 1 is the first, 2 is the second..., if there is only one regular expression, generally fill in $1$, or you can have Multiple templates, such as $1$, $2$
  Matching numbers: -1 for all, 0 for random, 1 for first, 2 for second...
  Default value: If this is not matched, a default value defined for it

 2. Use of values ​​extracted by regular expressions

  The usage is as follows${orderid}

3. Recommend a regular expression tool, RegexTeste, which can be downloaded and used

      

 

 ps: If you want to know more about templates and data quantity, that is, data acquisition and processing in different situations, you can check the blog. Personally, I feel that the blogger wrote very well: https://wenku.baidu.com/view/e668f5f5b9f67c1cfad6195f312b3169a451eaf0.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325160729&siteId=291194637